Skip to content

Commit

Permalink
feat(modal): add new props to atom-modal interface and update stories
Browse files Browse the repository at this point in the history
  • Loading branch information
brunosf committed Feb 12, 2025
1 parent 7d58aae commit 07cf29b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ export namespace Components {
}
interface AtomModal {
"alertType"?: 'alert' | 'error';
"canDismiss"?: boolean;
"disablePrimaryButton": boolean;
"disableSecondaryButton": boolean;
"hasDivider": boolean;
"hasFooter": boolean;
"headerTitle": string;
"idName"?: string;
"isOpen": boolean;
"primaryButtonText"?: string;
"progress"?: number;
Expand Down Expand Up @@ -935,11 +937,13 @@ declare namespace LocalJSX {
}
interface AtomModal {
"alertType"?: 'alert' | 'error';
"canDismiss"?: boolean;
"disablePrimaryButton"?: boolean;
"disableSecondaryButton"?: boolean;
"hasDivider"?: boolean;
"hasFooter"?: boolean;
"headerTitle"?: string;
"idName"?: string;
"isOpen"?: boolean;
"onAtomCloseClick"?: (event: AtomModalCustomEvent<any>) => void;
"onAtomDidDismiss"?: (event: AtomModalCustomEvent<any>) => void;
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/components/modal/stories/modal.args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ export const ModalStoryArgs = {
category: Category.PROPERTIES,
},
},
id: {
control: 'text',
description: 'The id of the modal',
table: {
category: Category.PROPERTIES,
},
},
hasDivider: {
control: 'boolean',
description: 'if true, a divider will be added on the header and footer',
Expand Down Expand Up @@ -104,6 +111,14 @@ export const ModalStoryArgs = {
category: Category.PROPERTIES,
},
},
canDismiss: {
control: 'boolean',
description:
'If true, the modal can be dismissed by clicking outside the modal. Default is true',
table: {
category: Category.PROPERTIES,
},
},
atomCloseClick: {
action: 'atomCloseClick',
description:
Expand Down Expand Up @@ -227,4 +242,5 @@ export const ModalComponentArgs = {
disableSecondaryButton: false,
disablePrimaryButton: false,
isOpen: false,
canDismiss: true,
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const createModal = (args) => {
disable-secondary-button="${args.disableSecondaryButton}"
disable-primary-button="${args.disablePrimaryButton}"
is-open="${args.isOpen}"
can-dismiss="${args.canDismiss}"
id="${args.id}"
>
<div slot="header">Custom Header</div>
<p>Modal Content</p>
Expand Down Expand Up @@ -63,7 +65,7 @@ export const Alert: StoryObj = {
},
}

export const Error: StoryObj = {
export const ErrorModal: StoryObj = {
render: (args) => createModal(args),
args: {
...ModalComponentArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const createModal = (args) => (
disablePrimaryButton={args.disablePrimaryButton}
disableSecondaryButton={args.disableSecondaryButton}
isOpen={args.isOpen}
canDismiss={args.canDismiss}
id={args.id}
>
<div slot='header'>Custom Header</div>
<p>Modal Content</p>
Expand Down Expand Up @@ -61,7 +63,7 @@ export const Alert: StoryObj = {
},
}

export const Error: StoryObj = {
export const ErrorModal: StoryObj = {
render: (args) => createModal(args),
args: {
...ModalComponentArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const createModal = (args, themeColor = 'light') => ({
disable-primary-button="${args.disablePrimaryButton}"
disable-secondary-button="${args.disableSecondaryButton}"
is-open="${args.isOpen}"
can-dismiss="${args.canDismiss}"
id="${args.id}"
>
<div slot='header'>Custom Header</div>
<p>Modal Content</p>
Expand Down Expand Up @@ -65,7 +67,7 @@ export const Alert: StoryObj = {
},
}

export const Error: StoryObj = {
export const ErrorModal: StoryObj = {
render: (args) => createModal(args),
args: {
...ModalComponentArgs,
Expand Down

0 comments on commit 07cf29b

Please sign in to comment.