import * as React from "react"
import { ComponentStory, ComponentMeta } from "@storybook/react"
import { Dialog } from "../src"

export default {
    title: "通用/Dialog",
    component: Dialog
} as ComponentMeta<typeof Dialog>

// Story模版
const Template: ComponentStory<typeof Dialog> = args => {
    const [show, setShow] = React.useState(false)

    const handleClose = () => {
        setShow(false)
    }

    return (
        <div>
            <button style={{ marginBottom: 20 }} onClick={e => setShow(!show)}>
                显示
            </button>

            <Dialog {...args} open={show} onClose={handleClose} />
        </div>
    )
}

export const Normal = Template.bind({})
