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

export default {
  title: "确认弹窗/PreferenceConfirm",
  component: PreferenceConfirm
} as ComponentMeta<typeof PreferenceConfirm>

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

  const onClose = () => setShow(false)

  return (
    <div>
      <button onClick={() => setShow(true)}>显示</button>

      <PreferenceConfirm
        open={show}
        onClose={onClose}
        onOk={() => {
          alert("确认")
          onClose()
        }}
      />
    </div>
  )
}

export const Normal = Template.bind({})
