import { Page } from 'puppeteer' import React, { useState } from 'react' import { Alert, Button, ColorPicker, DateInputField, Modal, SelectField, Text } from '../' import { Action, actions, HIDE_CONTROL, Story, STRING } from '../helpers/storybook' import { modalType } from './Modal' export default { title: 'Modal', component: Modal, argTypes: { className: HIDE_CONTROL, isOpen: HIDE_CONTROL, variant: { options: modalType }, modalLabel: STRING, ...actions('onClose'), }, } as const type CloseArg = { onClose: Action } interface BasicArgs extends CloseArg { contents: string styleProps: React.ComponentProps } export const BasicUsage: Story = ({ contents, onClose, styleProps, ...args }) => { const [open, setOpen] = useState(true) return open ? ( setOpen(false))}> {contents} ) : ( ) } BasicUsage.args = { contents: 'This is a Modal', styleProps: {} } export const WithAlert: Story = ({ onClose, ...args }) => { const [open, setOpen] = useState(true) return open ? ( setOpen(false))}> An alert inside the modal. ) : ( ) } export const WithPopups: Story = ({ onClose, ...args }) => { const [open, setOpen] = useState(true) return open ? ( setOpen(false))}> ) : ( ) } WithPopups.parameters = { beforeScreenshot: async (page: Page) => { await page.click('[aria-label="Open date picker"]') }, }