Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
chore: add multiple modal stories (#5387)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lisi Linhart committed Mar 13, 2024
1 parent 52b1218 commit dea764e
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/components/Modal/SbModal.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,62 @@ export const ModalTarget: Story = {
disabledTargetDefault: true,
},
}

export const MultipleModals: Story = {
render: (args: Args) => ({
components: {
SbModal,
SbModalContent,
SbButton,
},

setup: () => {
const isModalOneVisible = ref(false)
const isModalTwoVisible = ref(false)

const handleShowModal = (type: string) => {
if (type === 'one') {
isModalOneVisible.value = true
}
if (type === 'two') {
isModalTwoVisible.value = true
}
}

return { args, isModalOneVisible, isModalTwoVisible, handleShowModal }
},

template: `
<div>
<SbButton
label="Show Modal One"
variant="primary"
@click="handleShowModal('one')"
/>
<SbModal
v-bind="args"
:is-open="isModalOneVisible"
@hide="isModalOneVisible = false"
>
<SbModalContent>
<p style="text-align:center">This is modal one</p>
<SbButton
label="Show Modal Two"
variant="primary"
@click="handleShowModal('two')"
/>
</SbModalContent>
</SbModal>
<SbModal
v-bind="args"
:is-open="isModalTwoVisible"
@hide="isModalTwoVisible = false"
>
<SbModalContent>
<p style="text-align:center">This is modal two</p>
</SbModalContent>
</SbModal>
</div>
`,
}),
}

0 comments on commit dea764e

Please sign in to comment.