userMisery.stories.js 1.9 KB

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