import React, { useState } from 'react'; import { ComponentStory, ComponentMeta } from '@storybook/react'; import Box from '../../ui/box'; import { DISPLAY } from '../../../helpers/constants/design-system'; import { BUTTON_VARIANT, Button, Text, Modal, ModalHeader } from '..'; import { ModalContent } from './modal-content'; import { ModalContentSize } from './modal-content.types'; import README from './README.mdx'; export default { title: 'Components/ComponentLibrary/ModalContent', component: ModalContent, parameters: { docs: { page: README, }, }, argTypes: { size: { control: 'select', options: Object.values(ModalContentSize), }, }, } as ComponentMeta; const LoremIpsum = () => ( Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod tortor vitae nisi blandit, eu aliquam nisl ultricies. Donec euismod scelerisque nisl, sit amet aliquet nunc. Donec euismod, nisl vitae consectetur aliquam, nunc nunc ultricies nunc, eget aliquam nisl nisl vitae nunc. Donec euismod, nisl vitae consectetur aliquam, nunc nunc ultricies nunc, eget aliquam nisl nisl vitae nunc. Donec euismod, nisl vitae consectetur aliquam, nunc nunc ultricies nunc, eget aliquam nisl nisl vitae nunc. Donec euismod, nisl vitae consectetur aliquam, nunc ); export const DefaultStory: ComponentStory = (args) => { const [show, setShow] = useState(false); const handleOnClick = () => { setShow(!show); }; return ( <> Modal Header Modal Content ); }; DefaultStory.storyName = 'Default'; export const Children: ComponentStory = (args) => { const [show, setShow] = useState(false); const handleOnClick = () => { setShow(!show); }; return ( <> Modal Header The ModalContent with ModalHeader and Text components as children ); }; enum ModalContentSizeStoryOption { Sm = 'sm', ClassName = 'className', } export const Size: ComponentStory = (args) => { const [show, setShow] = useState({ sm: false, className: false, }); const handleOnClick = (size: ModalContentSizeStoryOption) => { setShow({ ...show, [size]: !show[size] }); }; return ( <> handleOnClick(ModalContentSizeStoryOption.Sm)} > ModalContentSize.Sm default and only size 360px max-width handleOnClick(ModalContentSizeStoryOption.ClassName)} > Using modalDialogProps and adding a className setting a max width (max-width: 800px) ); };