userMisery.stories.js 1.8 KB

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