miniChartPanel.tsx 919 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import {Panel} from 'sentry/components/panels';
  4. import {space} from 'sentry/styles/space';
  5. import textStyles from 'sentry/styles/text';
  6. type Props = {
  7. children: React.ReactNode;
  8. button?: JSX.Element;
  9. title?: string;
  10. };
  11. export default function MiniChartPanel({title, children, button}: Props) {
  12. return (
  13. <Panel>
  14. <PanelBody>
  15. <Header>
  16. {title && <ChartLabel>{title}</ChartLabel>}
  17. {button}
  18. </Header>
  19. {children}
  20. </PanelBody>
  21. </Panel>
  22. );
  23. }
  24. const ChartLabel = styled('p')`
  25. ${p => p.theme.text.cardTitle}
  26. `;
  27. const Header = styled('div')`
  28. padding: 0 ${space(1)} ${space(1)} 0;
  29. min-height: 24px;
  30. width: 100%;
  31. display: flex;
  32. align-items: center;
  33. justify-content: space-between;
  34. `;
  35. const PanelBody = styled('div')`
  36. padding: ${space(1.5)} ${space(2)};
  37. ${textStyles};
  38. `;