Button.stories.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { createButton } from './Button';
  2. // More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
  3. export default {
  4. title: 'Example/Button',
  5. // More on argTypes: https://storybook.js.org/docs/html/api/argtypes
  6. argTypes: {
  7. backgroundColor: { control: 'color' },
  8. label: { control: 'text' },
  9. onClick: { action: 'onClick' },
  10. primary: { control: 'boolean' },
  11. size: {
  12. control: { type: 'select' },
  13. options: ['small', 'medium', 'large'],
  14. },
  15. },
  16. };
  17. // More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
  18. const Template = ({ label, ...args }) => {
  19. // You can either use a function to create DOM elements or use a plain html string!
  20. // return `<div>${label}</div>`;
  21. return createButton({ label, ...args });
  22. };
  23. export const Primary = Template.bind({});
  24. // More on args: https://storybook.js.org/docs/html/writing-stories/args
  25. Primary.args = {
  26. primary: true,
  27. label: 'Button',
  28. };
  29. export const Secondary = Template.bind({});
  30. Secondary.args = {
  31. label: 'Button',
  32. };
  33. export const Large = Template.bind({});
  34. Large.args = {
  35. size: 'large',
  36. label: 'Button',
  37. };
  38. export const Small = Template.bind({});
  39. Small.args = {
  40. size: 'small',
  41. label: 'Button',
  42. };