pageHeadingQuestionTooltip.tsx 983 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import styled from '@emotion/styled';
  2. import QuestionTooltip from 'sentry/components/questionTooltip';
  3. import {t} from 'sentry/locale';
  4. import {space} from 'sentry/styles/space';
  5. import ExternalLink from './links/externalLink';
  6. type TooltipProps = Omit<React.ComponentProps<typeof QuestionTooltip>, 'size'>;
  7. interface PageHeadingQuestionTooltipProps extends TooltipProps {
  8. /**
  9. * The link to the documentation for this page.
  10. */
  11. docsUrl: string;
  12. }
  13. export function PageHeadingQuestionTooltip({
  14. docsUrl,
  15. title,
  16. ...props
  17. }: PageHeadingQuestionTooltipProps) {
  18. const contents = (
  19. <Container>
  20. {title}
  21. <ExternalLink href={docsUrl}>{t('Read the Docs')}</ExternalLink>
  22. </Container>
  23. );
  24. return (
  25. <QuestionTooltip isHoverable position="right" size="sm" title={contents} {...props} />
  26. );
  27. }
  28. const Container = styled('div')`
  29. display: inline-flex;
  30. flex-direction: column;
  31. align-items: flex-start;
  32. text-align: left;
  33. gap: ${space(1)};
  34. `;