chartPanel.tsx 892 B

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