chartPanel.tsx 865 B

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