charts-optionselector.stories.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import styled from '@emotion/styled';
  2. import OptionSelector from 'sentry/components/charts/optionSelector';
  3. import space from 'sentry/styles/space';
  4. const options = [
  5. {value: 'all', label: 'All things'},
  6. {value: 'none', label: 'No things'},
  7. {value: 'top5', label: 'Top 5 things that is a much longer title'},
  8. {value: 'nope', disabled: true, label: 'Disabled option'},
  9. {value: 'more', label: 'Additional option'},
  10. ];
  11. export default {
  12. title: 'Components/Data Visualization/Charts/Option Selector',
  13. component: OptionSelector,
  14. args: {
  15. selected: 'none',
  16. title: 'Display',
  17. options,
  18. menuWidth: '200px',
  19. },
  20. argTypes: {
  21. onChange: {action: 'changed'},
  22. },
  23. };
  24. export const Default = ({...args}) => (
  25. <Container style={{padding: '0 50px 200px'}}>
  26. <OptionSelector {...args} />
  27. </Container>
  28. );
  29. Default.storyName = 'Option Selector';
  30. Default.parameters = {
  31. docs: {
  32. description: {
  33. story: 'Selector control for chart controls',
  34. },
  35. },
  36. };
  37. const Container = styled('div')`
  38. padding: ${space(2)} ${space(3)};
  39. `;