profilingOnboardingPanel.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import emptyStateImg from 'sentry-images/spot/profiling-empty-state.svg';
  4. import ButtonBar from 'sentry/components/buttonBar';
  5. import OnboardingPanel from 'sentry/components/onboardingPanel';
  6. import {t} from 'sentry/locale';
  7. interface ProfilingOnboardingPanelProps {
  8. children: React.ReactNode;
  9. content?: React.ReactNode;
  10. }
  11. export function ProfilingOnboardingPanel(props: ProfilingOnboardingPanelProps) {
  12. return (
  13. <OnboardingPanel image={<HeroImage src={emptyStateImg} />}>
  14. {props.content ? (
  15. props.content
  16. ) : (
  17. <Fragment>
  18. <h3>{t('Function level insights')}</h3>
  19. <p>
  20. {t(
  21. 'Discover slow-to-execute or resource intensive functions within your application'
  22. )}
  23. </p>
  24. </Fragment>
  25. )}
  26. <ButtonList gap={1}>{props.children}</ButtonList>
  27. </OnboardingPanel>
  28. );
  29. }
  30. const HeroImage = styled('img')`
  31. @media (min-width: ${p => p.theme.breakpoints.small}) {
  32. user-select: none;
  33. position: absolute;
  34. top: 0;
  35. bottom: 0;
  36. width: 220px;
  37. margin-top: auto;
  38. margin-bottom: auto;
  39. transform: translateX(-50%);
  40. left: 50%;
  41. }
  42. @media (min-width: ${p => p.theme.breakpoints.large}) {
  43. transform: translateX(-55%);
  44. width: 300px;
  45. min-width: 300px;
  46. }
  47. @media (min-width: ${p => p.theme.breakpoints.xlarge}) {
  48. transform: translateX(-60%);
  49. width: 380px;
  50. min-width: 380px;
  51. }
  52. @media (min-width: ${p => p.theme.breakpoints.xxlarge}) {
  53. transform: translateX(-65%);
  54. width: 420px;
  55. min-width: 420px;
  56. }
  57. `;
  58. const ButtonList = styled(ButtonBar)`
  59. grid-template-columns: repeat(auto-fit, minmax(130px, max-content));
  60. `;