import React from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { useModal } from '../../hooks/useModal'; import { predefinedArgTypes } from '../../utils/storybook'; import { Button } from '../Button/Button'; import { Table } from '../Table/Table/Table'; import { TableBody } from '../Table/TableBody/TableBody'; import { TableCell } from '../Table/TableCell/TableCell'; import { TableHeader } from '../Table/TableHeader/TableHeader'; import { TableHeaderCell } from '../Table/TableHeaderCell/TableHeaderCell'; import { TableRow } from '../Table/TableRow/TableRow'; import { Paragraph } from '../Typography/Paragraph/Paragraph'; import { Modal } from './Modal'; const meta: Meta = { title: 'UI kit/Modal', component: Modal, tags: ['autodocs'], argTypes: { isOpen: { control: { disable: true, }, }, }, }; export default meta; type Story = StoryObj; export const Default: Story = { args: { canBeDismissed: true, level: undefined, }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Basic Modal {predefinedArgTypes.string.mapping['"Lorem ipsum" (paragraph)']} {({ secondaryButtonProps, actionButtonProps }) => ( <> )} ); }, }; export const WithFixedMaxWidth: Story = { name: 'With fixed max-width', args: { canBeDismissed: true, maxWidth: true, level: undefined, }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Basic Modal {predefinedArgTypes.string.mapping['"Lorem ipsum" (paragraph)']} {({ secondaryButtonProps, actionButtonProps }) => ( <> )} ); }, }; export const WithoutFooter: Story = { args: { canBeDismissed: true, level: undefined, }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Basic Modal This is a content of this modal. It can be text or whatever else. ); }, }; export const WithoutTitle: Story = { args: { canBeDismissed: true, level: undefined, }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Header cell 1 Header cell 2 {[1, 2, 3, 4].map(item => ( {`Row ${item}, cell 1`} {`Row ${item}, cell 2`} ))}
); }, }; export const Notification: Story = { args: { canBeDismissed: true, level: 'success', }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Notification This is a content of this modal. It can be text or whatever else. {({ actionButtonProps }) => ( )} ); }, }; export const WithError: Story = { args: { canBeDismissed: true, level: 'error', }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Are you sure? Are you sure that you want to delete this item? {({ secondaryButtonProps, actionButtonProps }) => ( <> )} ); }, }; export const WithAlert: Story = { args: { canBeDismissed: true, level: 'alert', }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Are you sure? Are you sure that you want to delete this item? {({ secondaryButtonProps, actionButtonProps }) => ( <> )} ); }, }; export const WithSuccess: Story = { args: { canBeDismissed: true, level: 'success', }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Success Congratulations {({ actionButtonProps }) => ( )} ); }, }; export const WithNotice: Story = { args: { canBeDismissed: true, level: 'notice', }, render: args => { const { onClose, isOpen, openModal } = useModal(); return ( <> Notification Please notice it {({ actionButtonProps }) => ( )} ); }, };