scoreBar.stories.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React from 'react';
  2. import {storiesOf} from '@storybook/react';
  3. import {withInfo} from '@storybook/addon-info';
  4. import {number, boolean, array, color} from '@storybook/addon-knobs';
  5. import ScoreBar from 'app/components/scoreBar';
  6. storiesOf('Other|ScoreBar', module)
  7. .add(
  8. 'horizontal',
  9. withInfo('Description')(() => (
  10. <div style={{backgroundColor: 'white', padding: 12}}>
  11. <ScoreBar
  12. vertical={boolean('Vertical', false)}
  13. size={number('Size')}
  14. thickness={number('Thickness')}
  15. score={number('Score', 3)}
  16. />
  17. </div>
  18. ))
  19. )
  20. .add(
  21. 'vertical',
  22. withInfo('Description')(() => {
  23. return (
  24. <div style={{backgroundColor: 'white', padding: 12}}>
  25. <ScoreBar
  26. vertical={boolean('Vertical', true)}
  27. size={number('Size')}
  28. thickness={number('Thickness')}
  29. score={number('Score', 3)}
  30. />
  31. </div>
  32. );
  33. })
  34. )
  35. .add(
  36. 'custom palette',
  37. withInfo('Description')(() => {
  38. let palette = array('Palette', [
  39. color('Lower', 'pink'),
  40. color('Low', 'yellow'),
  41. color('Med', 'lime'),
  42. color('High', 'blue'),
  43. color('Higher', 'purple'),
  44. ]);
  45. return (
  46. <div style={{backgroundColor: 'white', padding: 12}}>
  47. <ScoreBar
  48. vertical={boolean('Vertical', false)}
  49. size={number('Size')}
  50. thickness={number('Thickness')}
  51. score={number('Score', 3)}
  52. palette={palette}
  53. />
  54. </div>
  55. );
  56. })
  57. );