simpleTableChart.stories.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React from 'react';
  2. import SimpleTableChart from 'app/components/charts/simpleTableChart';
  3. export default {
  4. title: 'DataVisualization/Charts/SimpleTableChart',
  5. component: SimpleTableChart,
  6. args: {
  7. title: '',
  8. },
  9. };
  10. export const _SimpleTableChart = ({title}) => {
  11. const organization = {slug: 'org-slug'};
  12. const fields = ['title', 'count()'];
  13. const metadata = {count: 'string', title: 'string'};
  14. const data = [
  15. {title: 'An error', count: 100},
  16. {title: 'An longer title that goes on a bit', count: 1000},
  17. ];
  18. return (
  19. <div className="section">
  20. <h2>Loading State</h2>
  21. <SimpleTableChart
  22. organization={organization}
  23. fields={fields}
  24. title={title}
  25. metadata={undefined}
  26. data={[]}
  27. loading
  28. />
  29. <h2>Filled State</h2>
  30. <SimpleTableChart
  31. organization={organization}
  32. fields={fields}
  33. title={title}
  34. metadata={metadata}
  35. data={data}
  36. />
  37. </div>
  38. );
  39. };
  40. _SimpleTableChart.parameters = {
  41. docs: {
  42. description: {
  43. story: 'A borderless table that can be used in charts/dashboards',
  44. },
  45. },
  46. };