collapsible.stories.js 920 B

12345678910111213141516171819202122232425262728293031323334
  1. import {Button} from 'sentry/components/button';
  2. import Collapsible from 'sentry/components/collapsible';
  3. import {tn} from 'sentry/locale';
  4. export default {
  5. title: 'Utilities/Hidden Content/Collapsible',
  6. component: Collapsible,
  7. };
  8. export const Default = ({...args}) => (
  9. <Collapsible {...args}>
  10. {[1, 2, 3, 4, 5, 6, 7].map(item => (
  11. <div key={item}>Item {item}</div>
  12. ))}
  13. </Collapsible>
  14. );
  15. export const CustomButtons = ({...args}) => {
  16. return (
  17. <Collapsible
  18. {...args}
  19. collapseButton={({onCollapse}) => <Button onClick={onCollapse}>Collapse</Button>}
  20. expandButton={({onExpand, numberOfCollapsedItems}) => (
  21. <Button onClick={onExpand}>
  22. {tn('Expand %s item', 'Expand %s items', numberOfCollapsedItems)}
  23. </Button>
  24. )}
  25. >
  26. {[1, 2, 3, 4, 5, 6, 7].map(item => (
  27. <div key={item}>Item {item}</div>
  28. ))}
  29. </Collapsible>
  30. );
  31. };