Skip to content

Commit

Permalink
Add clean sample for Notification component
Browse files Browse the repository at this point in the history
  • Loading branch information
rogaldh committed Mar 28, 2024
1 parent 0de86bd commit ff8b815
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions packages/ui/src/__stories__/features/notification.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,46 @@ const notificationStory = {
export default notificationStory

export const Default: StoryObj<React.ComponentProps<typeof Notification>> = {
args: {},
parameters: {
docs: {
source: {
type: "code",
code: `
<NotificationProvider
onInspect={({ link }) => {}}
swipeDirection="right"
>
<Inner />
</NotificationProvider>
function Inner() {
const { setNotification } = useNotificationContext()
return (
<button
onClick={() => setNotification({ message: "text", link: "https://example.com" })}
>
Show toast
</button>
)
}
`,
},
},
},
render: () => {
const { setNotification } = useNotificationContext()

return (
<>
<button
type="button"
role="button"
className="ml-3 rounded-md bg-white text-sm font-medium"
onClick={() => {
setNotification({ message: "Notification text" })
}}
>
Show Notification
</button>
</>
<button
type="button"
role="button"
className="ml-3 rounded-md bg-white text-sm font-medium"
onClick={() => {
setNotification({ message: "Notification text" })
}}
>
Show Notification
</button>
)
},
async play({ canvasElement, step }: any) {
Expand Down

0 comments on commit ff8b815

Please sign in to comment.