chartPanel.tsx 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React from 'react';
  2. import styled from '@emotion/styled';
  3. import {Panel, PanelBody} from 'sentry/components/panels';
  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. <Header>
  15. {title && <ChartLabel>{title}</ChartLabel>}
  16. {button}
  17. </Header>
  18. {children}
  19. </PanelBody>
  20. </Panel>
  21. );
  22. }
  23. const ChartLabel = styled('p')`
  24. ${p => p.theme.text.cardTitle}
  25. `;
  26. const Header = styled('div')`
  27. padding: 0 ${space(1)} 0 0;
  28. min-height: 36px;
  29. width: 100%;
  30. display: flex;
  31. align-items: center;
  32. justify-content: space-between;
  33. `;