colorBar.stories.js 924 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import theme from 'app/utils/theme';
  4. import ColorBar from 'app/views/performance/vitalDetail/colorBar.tsx';
  5. export default {
  6. title: 'Features/Vitals/ColorBar',
  7. component: ColorBar,
  8. args: {
  9. colorStops: [
  10. {
  11. color: theme.green300,
  12. percent: 0.6,
  13. },
  14. {
  15. color: theme.yellow300,
  16. percent: 0.3,
  17. },
  18. {
  19. color: theme.red300,
  20. percent: 0.1,
  21. },
  22. ],
  23. },
  24. };
  25. export const Default = ({...args}) => (
  26. <Container>
  27. <ColorBar {...args} />
  28. </Container>
  29. );
  30. Default.storyName = 'ColorBar';
  31. Default.parameters = {
  32. docs: {
  33. description: {
  34. story:
  35. 'Split a group of percentages or ratios into separate colors. Will stretch to cover the entire bar if missing percents',
  36. },
  37. },
  38. };
  39. const Container = styled('div')`
  40. display: inline-block;
  41. width: 300px;
  42. `;