-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: made modal footer button lg * fix: updated form modal styles to match design, used asChild prop to get rid of nested buttons * refactor: moved Modal.example to ModalForm.example * refactor: updated styling for modals and added info and custom modal examples * fix: right aligned buttons on custom modal to show layout options
- Loading branch information
Showing
7 changed files
with
209 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
23 changes: 17 additions & 6 deletions
23
stories/Modal/Modal.stories.ts → stories/Modal/Modal.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,40 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { ModalDemo } from './Modal.example' | ||
import { ModalInfoDemo } from './ModalInfo.example' | ||
import { ModalCustomDemo } from './ModalCustom.example' | ||
import { ModalFormDemo } from './ModalForm.example' | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
const meta = { | ||
title: 'Components/Modal', | ||
component: ModalDemo, | ||
component: ModalFormDemo, | ||
parameters: { | ||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: 'centered' | ||
}, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs | ||
argTypes: { | ||
className: { | ||
controle: 'text', | ||
control: 'text', | ||
description: 'Alter the className to change the style' | ||
} | ||
} | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
} satisfies Meta<typeof ModalDemo> | ||
} satisfies Meta<typeof ModalFormDemo> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args | ||
export const Default: Story = { | ||
args: {} | ||
|
||
export const Info: Story = { | ||
render: () => <ModalInfoDemo /> | ||
} | ||
|
||
export const Custom: Story = { | ||
render: () => <ModalCustomDemo /> | ||
} | ||
|
||
export const Form: Story = { | ||
render: () => <ModalFormDemo /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
Modal, | ||
ModalContent, | ||
ModalClose, | ||
ModalFooter, | ||
ModalDescription, | ||
ModalHeader, | ||
ModalTitle, | ||
ModalTrigger | ||
} from '@/components/Modal' | ||
import { Button } from '@/components' | ||
|
||
export const ModalCustomDemo = () => ( | ||
<Modal> | ||
<Button size="sm" variant="primary" asChild> | ||
<ModalTrigger>Open</ModalTrigger> | ||
</Button> | ||
<ModalContent> | ||
<ModalHeader> | ||
<ModalTitle>Title</ModalTitle> | ||
<ModalClose /> | ||
</ModalHeader> | ||
<ModalDescription asChild> | ||
<div> | ||
<div className="bg-blue-50 dark:bg-blue-900 dark:text-foreground-inverse h-40 text-lg font-semibold items-center flex justify-center mb-6 mx-6"> | ||
Replace this component with your content | ||
</div> | ||
</div> | ||
</ModalDescription> | ||
<ModalFooter> | ||
<div className="flex justify-end gap-2.5"> | ||
<Button variant="tertiary">Label</Button> | ||
<Button variant="secondary">Label</Button> | ||
<Button>Label</Button> | ||
</div> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { | ||
Modal, | ||
ModalContent, | ||
ModalClose, | ||
ModalCloseFooter, | ||
ModalFooter, | ||
ModalDescription, | ||
ModalHeader, | ||
ModalTitle, | ||
ModalTrigger | ||
} from '@/components/Modal' | ||
import { Button } from '@/components' | ||
|
||
export const ModalFormDemo = () => ( | ||
<Modal> | ||
<Button size="sm" variant="primary" asChild> | ||
<ModalTrigger>Open</ModalTrigger> | ||
</Button> | ||
<ModalContent> | ||
<ModalHeader variant="form"> | ||
<ModalTitle>Title</ModalTitle> | ||
<ModalClose /> | ||
</ModalHeader> | ||
<ModalDescription variant="form" asChild> | ||
<div> | ||
<div className="bg-blue-50 dark:bg-blue-900 dark:text-foreground-inverse h-40 text-lg font-semibold items-center flex justify-center mb-6 mx-6"> | ||
Replace this component with your form | ||
</div> | ||
</div> | ||
</ModalDescription> | ||
<ModalFooter> | ||
<Button size="lg" variant="primary" asChild> | ||
<ModalCloseFooter className="w-full grid gap-2"> | ||
Close | ||
</ModalCloseFooter> | ||
</Button> | ||
<div className="flex justify-center gap-4"> | ||
<div className="text-foreground-muted">Additional text line</div> | ||
<div className="dark:text-primary-300 underline text-primary-600"> | ||
Additional text line | ||
</div> | ||
</div> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
Modal, | ||
ModalContent, | ||
ModalClose, | ||
ModalFooter, | ||
ModalDescription, | ||
ModalHeader, | ||
ModalTitle, | ||
ModalTrigger | ||
} from '@/components/Modal' | ||
import { Button } from '@/components' | ||
|
||
export const ModalInfoDemo = () => ( | ||
<Modal> | ||
<Button size="sm" variant="primary" asChild> | ||
<ModalTrigger>Open</ModalTrigger> | ||
</Button> | ||
<ModalContent> | ||
<ModalHeader> | ||
<ModalTitle>Title</ModalTitle> | ||
<ModalClose /> | ||
</ModalHeader> | ||
<ModalDescription className="h-40 text-foreground text-base" asChild> | ||
<div> | ||
<p className="mb-6 mx-6">Test</p> | ||
</div> | ||
</ModalDescription> | ||
<ModalFooter> | ||
<div className="flex justify-start gap-2.5"> | ||
<Button>Label</Button> | ||
<Button variant="secondary">Label</Button> | ||
<Button variant="tertiary">Label</Button> | ||
</div> | ||
</ModalFooter> | ||
</ModalContent> | ||
</Modal> | ||
) |