selectFields.stories.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import {action} from '@storybook/addon-actions';
  2. import {Form as LegacyForm} from 'sentry/components/deprecatedforms';
  3. import SelectCreatableField from 'sentry/components/deprecatedforms/selectCreatableField';
  4. import SelectField from 'sentry/components/deprecatedforms/selectField';
  5. export default {
  6. title: 'Deprecated/SelectFields',
  7. };
  8. export const _SelectField = () => (
  9. <LegacyForm onSubmit={action('onSubmit')}>
  10. <SelectField
  11. name="foos"
  12. choices={[
  13. ['foo', 'Foo'],
  14. ['bar', 'Bar'],
  15. ['baz', 'Baz'],
  16. ]}
  17. />
  18. <SelectField
  19. name="multi_foos"
  20. choices={[
  21. ['foo', 'Foo'],
  22. ['bar', 'Bar'],
  23. ['baz', 'Baz'],
  24. ]}
  25. multiple
  26. />
  27. </LegacyForm>
  28. );
  29. _SelectField.storyName = 'SelectField';
  30. export const _SelectCreatableField = () => (
  31. <LegacyForm onSubmit={action('onSubmit')}>
  32. <SelectCreatableField
  33. label="Creatable"
  34. name="creatable_foos"
  35. choices={[
  36. ['foo', 'Foo'],
  37. ['bar', 'Bar'],
  38. ['baz', 'Baz'],
  39. ]}
  40. />
  41. <SelectCreatableField
  42. label="Creatable (and Multiple)"
  43. name="creatable_multi_foos"
  44. multiple
  45. choices={[
  46. ['foo', 'Foo'],
  47. ['bar', 'Bar'],
  48. ['baz', 'Baz'],
  49. ]}
  50. />
  51. </LegacyForm>
  52. );
  53. _SelectCreatableField.storyName = 'SelectCreatableField';