import { storiesOf } from "@storybook/react"; import { number, select, text, boolean, withKnobs } from "@storybook/addon-knobs"; import { withInfo } from "@storybook/addon-info"; import { addReadme } from "storybook-readme"; import React from "react"; import AllocWantedModal from "@components/Payment/AllocWantedModal"; import { Button, Divider, Modal } from "antd"; import WantedPublishView, { WantedViewWranModel } from "@components/Payment/WantedPublishView"; import WantedPublishModal from "@components/Payment/WantedPublishModal"; import WantedPublishPopover from "@components/Payment/WantedPublishPopover"; import { ModalCMD } from "@components/Common"; const stories = storiesOf("Payment/Wanted", module); stories.addDecorator(storyFn => (
{storyFn()}
)); stories.addDecorator(withKnobs); stories.addDecorator(withInfo); stories.addDecorator(addReadme); stories.add( "AllocWantedModal", () => { return ( { console.log(args); }} sendGiftData={{ answerId: text("answerId", "1"), questionId: text("questionId", "1"), toUserId: text("toUserId", "1") }} handleVisibleChange={visiable => { console.log(visiable); }} > ); }, { info: { inline: true }, notes: "A very simple example of addon notes" } ); stories.add( "WantedPushView", () => { const [currentWanted, setCurrentWanted] = React.useState(0); return (
setCurrentWanted(value)} InputWantedOnBlur={(blurValue: any) => setCurrentWanted(blurValue)} InputWantedClear={() => setCurrentWanted(0)} InputWantedPressEnter={(enterValue: any) => setCurrentWanted(enterValue) } InputWantedConfirm={() => { console.log("Close Button"); }} />
currentWanted: {currentWanted}
); }, { info: { inline: true }, notes: "A very simple example of addon notes" } ); stories.add( "WantedPublishPopover And Modal", () => { const [wanted, setWanted] = React.useState(""); const [testModal, setTestModal] = React.useState(false); return (
) => { console.log("wanted", wanted); console.log("value", value); if (Number(wanted) - value > 0) { WantedViewWranModel({ refMount: document.body, actionConfirm: () => { setWanted(value); }, actionCancel: () => {} }); return; } setWanted(value); }} viewConfig={{ showInputWantedClear: boolean( "viewConfig.showInputWantedClear", false ) }} >
ModalClick
) => { if (Number(wanted) - value > 0) { WantedViewWranModel({ refMount: document.body, actionConfirm: () => { setWanted(value); }, actionCancel: () => {} }); return; } setWanted(value); }} viewConfig={{ showInputWantedClear: boolean( "viewConfig.showInputWantedClear", false ) }} >
setTestModal(true)}>Show Modal
setTestModal(false)} onOk={() => setTestModal(true)} >
ModalClick
{/* 下面用于分割wanted值的渲染,防止Error */} {(wanted => (
wanted{wanted}
))(wanted)}
); }, { info: { inline: true }, notes: "A very simple example of addon notes" } );