userMisery.stories.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import UserMisery from 'app/components/userMisery';
  4. export default {
  5. title: 'DataVisualization/ScoreBar/UserMisery',
  6. component: UserMisery,
  7. };
  8. const Template = ({...args}) => (
  9. <Container>
  10. <UserMisery {...args} />
  11. </Container>
  12. );
  13. export const Default = Template.bind({});
  14. Default.storyName = 'default';
  15. Default.args = {
  16. bars: 10,
  17. barHeight: 20,
  18. miseryLimit: 300,
  19. miserableUsers: 75,
  20. totalUsers: 100,
  21. };
  22. Default.parameters = {
  23. docs: {
  24. description: {
  25. story:
  26. 'Visualization of user misery to allow users to more easily understand performance at a glance',
  27. },
  28. },
  29. };
  30. export const Large = Template.bind({});
  31. Large.storyName = 'large';
  32. Large.args = {
  33. bars: 40,
  34. barHeight: 30,
  35. miseryLimit: 300,
  36. miserableUsers: 75,
  37. totalUsers: 100,
  38. };
  39. Large.parameters = {
  40. docs: {
  41. description: {
  42. story: 'Both length and height of the component can be modified',
  43. },
  44. },
  45. };
  46. export const Empty = Template.bind({});
  47. Empty.storyName = 'empty';
  48. Empty.args = {
  49. bars: 10,
  50. barHeight: 20,
  51. miseryLimit: 300,
  52. miserableUsers: 0,
  53. totalUsers: 0,
  54. };
  55. Empty.parameters = {
  56. docs: {
  57. description: {
  58. story: 'Empty state',
  59. },
  60. },
  61. };
  62. export const NearEmpty = Template.bind({});
  63. NearEmpty.storyName = 'near empty';
  64. NearEmpty.args = {
  65. bars: 10,
  66. barHeight: 20,
  67. miseryLimit: 300,
  68. miserableUsers: 1,
  69. totalUsers: 1000,
  70. };
  71. NearEmpty.parameters = {
  72. docs: {
  73. description: {
  74. story: 'Nearly empty state will still show 1 bar if there are any miserable users',
  75. },
  76. },
  77. };
  78. export const Full = Template.bind({});
  79. Full.storyName = 'full';
  80. Full.args = {
  81. bars: 10,
  82. barHeight: 20,
  83. miseryLimit: 300,
  84. miserableUsers: 1000,
  85. totalUsers: 1000,
  86. };
  87. Full.parameters = {
  88. docs: {
  89. description: {
  90. story: 'Full state',
  91. },
  92. },
  93. };
  94. const Container = styled('div')`
  95. display: inline-block;
  96. `;