Skip to content

Commit

Permalink
fix(modal): fix react modal-header-actions export
Browse files Browse the repository at this point in the history
add header action story

closes  #107
  • Loading branch information
Ashley Ryan authored and ashleyryan committed Jun 17, 2022
1 parent e7ea2cc commit ba90734
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion projects/core/custom-elements.json
Expand Up @@ -48513,7 +48513,7 @@
"declarations": [
{
"kind": "class",
"description": "Web component modal header actions to be used inside modal.\n\n```typescript\nimport '@cds/core/modal/register.js';\n```\n\n```html\n<cds-modal>\n <cds-modal-header>\n <h3 cds-text=\"title\">My Modal</h3>\n </cds-modal-header>\n <cds-modal-content>\n <p>Lorem Ipsum</p>\n </cds-modal-content>\n <cds-modal-actions>\n <cds-button>Ok</cds-button>\n </cds-modal-actions>\n</cds-modal>\n```",
"description": "Web component modal header actions to be used inside modal.\n\n```typescript\nimport '@cds/core/modal/register.js';\n```\n\n```html\n<cds-modal>\n <cds-modal-header>\n <h3 cds-text=\"title\">My Modal</h3>\n </cds-modal-header>\n <cds-modal-header-actions>\n <cds-button>Ok</cds-button>\n </cds-modal-header-actions>\n <cds-modal-content>\n <p>Lorem Ipsum</p>\n </cds-modal-content>\n</cds-modal>\n```",
"name": "CdsModalHeaderActions",
"members": [],
"superclass": {
Expand Down
6 changes: 3 additions & 3 deletions projects/core/src/modal/modal-header-actions.element.ts
Expand Up @@ -19,12 +19,12 @@ import { html, LitElement } from 'lit';
* <cds-modal-header>
* <h3 cds-text="title">My Modal</h3>
* </cds-modal-header>
* <cds-modal-header-actions>
* <cds-button>Ok</cds-button>
* </cds-modal-header-actions>
* <cds-modal-content>
* <p>Lorem Ipsum</p>
* </cds-modal-content>
* <cds-modal-actions>
* <cds-button>Ok</cds-button>
* </cds-modal-actions>
* </cds-modal>
* ```
*
Expand Down
9 changes: 9 additions & 0 deletions projects/core/src/modal/modal.stories.mdx
Expand Up @@ -20,6 +20,9 @@ import '@cds/core/modal/register.js';
<cds-modal-header>
<h3 cds-text="title">I have a nice title</h3>
</cds-modal-header>
<cds-modal-header-actions>
<cds-button>Do something in the header</cds-button>
</cds-modal-header-actions>
<cds-modal-content>
<p cds-text="body">But not much to say...</p>
</cds-modal-content>
Expand Down Expand Up @@ -54,6 +57,12 @@ import '@cds/core/modal/register.js';
<Story id="stories-modal--extra-large" />
</Preview>

## Header Actions

<Preview>
<Story id="stories-modal--header-actions" />
</Preview>

## Dark Theme

<Preview>
Expand Down
20 changes: 20 additions & 0 deletions projects/core/src/modal/modal.stories.ts
Expand Up @@ -6,6 +6,7 @@

import '@cds/core/modal/register.js';
import '@cds/core/button/register.js';
import '@cds/core/button-action/register.js';
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators/custom-element.js';
import { getElementStorybookArgs, property, spreadProps } from '@cds/core/internal';
Expand Down Expand Up @@ -165,6 +166,25 @@ export function extraLarge() {
`;
}

/** @website */
export function headerActions() {
return html`<cds-demo popover>
<cds-modal _demo-mode aria-labelledby="modal-title">
<cds-modal-header>
<h3 cds-text="section" cds-first-focus id="modal-title">Header Actions Modal Example</h3>
</cds-modal-header>
<cds-modal-header-actions cds-layout="horizontal gap:sm">
<cds-button-action shape="bars" aria-label="filter"></cds-button-action>
<cds-button-action shape="filter" aria-label="filter"></cds-button-action>
</cds-modal-header-actions>
<cds-modal-content>
<p cds-text="body">Place holder text for the header actions modal example.</p>
</cds-modal-content>
<cds-modal-actions></cds-modal-actions>
</cds-modal>
</cds-demo>`;
}

/** @website */
export function darkTheme() {
return html`
Expand Down
2 changes: 1 addition & 1 deletion projects/react/src/modal/index.tsx
Expand Up @@ -25,7 +25,7 @@ export const CdsModalContent = createComponent(React, 'cds-modal-content', Modal
export const CdsModalHeader = createComponent(React, 'cds-modal-header', ModalHeader, {}, 'CdsModalHeader');
export const CdsModalHeaderActions = createComponent(
React,
'cds-modal-header-action',
'cds-modal-header-actions',
ModalHeaderActions,
{},
'CdsModalHeaderActions'
Expand Down

0 comments on commit ba90734

Please sign in to comment.