domainStatusLink.tsx 950 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import styled from '@emotion/styled';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import {IconOpen} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import {space} from 'sentry/styles/space';
  6. import {useStatusPageList} from 'sentry/views/insights/http/queries/useStatusPageList';
  7. interface Props {
  8. domain?: string;
  9. }
  10. export function DomainStatusLink({domain}: Props) {
  11. const statusPageList = useStatusPageList();
  12. if (!domain) {
  13. return null;
  14. }
  15. const statusPageURL = statusPageList?.domainToStatusPageUrls?.[domain];
  16. if (!statusPageURL) {
  17. return null;
  18. }
  19. return (
  20. <ExternalDomainLink href={statusPageURL}>
  21. {t('Status')}
  22. <IconOpen />
  23. </ExternalDomainLink>
  24. );
  25. }
  26. const ExternalDomainLink = styled(ExternalLink)`
  27. display: inline-flex;
  28. font-weight: ${p => p.theme.fontWeightNormal};
  29. align-items: center;
  30. font-size: ${p => p.theme.fontSizeMedium};
  31. gap: ${space(1)};
  32. `;