address.stories.tsx 1.11 KB
Newer Older
zhanghaozhe committed
1 2 3 4
import React from "react"
import Address from "./index"
import { text, boolean, withKnobs } from "@storybook/addon-knobs"
import { action } from "@storybook/addon-actions"
zhanghaozhe committed
5 6

export default {
zhanghaozhe committed
7 8 9
  title: "address",
  component: Address,
  decorators: [withKnobs],
zhanghaozhe committed
10 11 12
}

let visible = true,
zhanghaozhe committed
13 14 15 16 17
  title = "收货地址",
  subtitle = "获奖用户(以最终榜单为准)请及时填写收货信息",
  address = "金域国际中心",
  phone = "1331234123",
  name = "某某某"
zhanghaozhe committed
18 19

export const Default = () => {
zhanghaozhe committed
20 21 22 23 24 25
  visible = boolean("visible", visible)
  name = text("name", name)
  phone = text("phone", phone)
  address = text("address", address)
  title = text("title(optional)", title)
  subtitle = text("subtitle(optional)", subtitle)
zhanghaozhe committed
26

zhanghaozhe committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
  return (
    <Address
      visible={visible}
      subtitle={subtitle}
      title={title}
      name={name}
      phone={phone}
      address={address}
      onClose={action("onClose")}
      validate={() => ({ name: "姓名" })}
      onError={(errors) => {
        console.log(errors)
      }}
      onSubmit={(values, formikHelpers) => {
        console.log(formikHelpers)
      }}
zhanghaozhe committed
43
    />
zhanghaozhe committed
44 45
  )
}