Nav apraksta

Common.stories.tsx 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import { storiesOf } from "@storybook/react";
  2. import { number, select, text, withKnobs } from "@storybook/addon-knobs";
  3. import { withInfo } from "@storybook/addon-info";
  4. import { addReadme } from "storybook-readme";
  5. import React from "react";
  6. import Modal, { ModalCMD } from "@components/Common/Modal";
  7. import { Button } from "antd";
  8. const stories = storiesOf("Common", module);
  9. stories.addDecorator(storyFn => (
  10. <div style={{ padding: "0px 40px" }}>{storyFn()}</div>
  11. ));
  12. stories.addDecorator(withKnobs);
  13. stories.addDecorator(withInfo);
  14. stories.addDecorator(addReadme);
  15. stories.add(
  16. "Modal",
  17. () => {
  18. const [vis, setVis] = React.useState(false);
  19. return (
  20. <div>
  21. <Button onClick={() => setVis(true)}>Modal</Button>
  22. <Modal visible={vis} onCancel={() => setVis(false)}>
  23. NormalModal
  24. </Modal>
  25. <Button
  26. onClick={() =>
  27. ModalCMD.show({
  28. children: <div>Hide</div>
  29. })
  30. }
  31. >
  32. ModalCMD.show
  33. </Button>
  34. </div>
  35. );
  36. },
  37. {
  38. info: { inline: true },
  39. notes: "A very simple example of addon notes"
  40. }
  41. );