firstEventFooter.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import {Button} from 'sentry/components/button';
  4. import ButtonBar from 'sentry/components/buttonBar';
  5. import {t, tct} from 'sentry/locale';
  6. import {space} from 'sentry/styles/space';
  7. import type {Organization} from 'sentry/types/organization';
  8. import type {Project} from 'sentry/types/project';
  9. import FirstEventIndicator from 'sentry/views/onboarding/components/firstEventIndicator';
  10. import CreateSampleEventButton from 'sentry/views/onboarding/createSampleEventButton';
  11. interface FirstEventFooterProps {
  12. organization: Organization;
  13. project: Project;
  14. docsLink?: string;
  15. docsOnClick?: () => void;
  16. }
  17. export default function FirstEventFooter({
  18. organization,
  19. project,
  20. docsLink,
  21. docsOnClick,
  22. }: FirstEventFooterProps) {
  23. return (
  24. <Fragment>
  25. <FirstEventIndicator
  26. organization={organization}
  27. project={project}
  28. eventType="error"
  29. >
  30. {({indicator, firstEventButton}) => (
  31. <CTAFooter>
  32. <Actions gap={2}>
  33. {firstEventButton}
  34. <Button external href={docsLink} onClick={docsOnClick}>
  35. {t('View full documentation')}
  36. </Button>
  37. </Actions>
  38. {indicator}
  39. </CTAFooter>
  40. )}
  41. </FirstEventIndicator>
  42. <CTASecondary>
  43. {tct(
  44. 'Just want to poke around before getting too cozy with the SDK? [sample:View a sample event for this SDK] or [skip:finish setup later].',
  45. {
  46. sample: (
  47. <CreateSampleEventButton
  48. aria-label={t('View a sample event')}
  49. project={project}
  50. source="onboarding"
  51. priority="link"
  52. />
  53. ),
  54. skip: (
  55. <Button priority="link" href="/" aria-label={t('Finish setup later')} />
  56. ),
  57. }
  58. )}
  59. </CTASecondary>
  60. </Fragment>
  61. );
  62. }
  63. const CTAFooter = styled('div')`
  64. display: flex;
  65. justify-content: space-between;
  66. margin: ${space(2)} 0;
  67. margin-top: ${space(4)};
  68. `;
  69. const CTASecondary = styled('p')`
  70. color: ${p => p.theme.subText};
  71. font-size: ${p => p.theme.fontSizeMedium};
  72. margin: 0;
  73. max-width: 500px;
  74. `;
  75. const Actions = styled(ButtonBar)`
  76. display: inline-grid;
  77. justify-self: start;
  78. `;