sourceSuggestionExamples.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import styled from '@emotion/styled';
  2. import {Hovercard} from 'sentry/components/hovercard';
  3. import {IconQuestion} from 'sentry/icons';
  4. import {t} from 'sentry/locale';
  5. import space from 'sentry/styles/space';
  6. type Props = {
  7. examples: Array<string>;
  8. sourceName: string;
  9. };
  10. const SourceSuggestionExamples = ({examples, sourceName}: Props) => (
  11. <Wrapper>
  12. <ExampleCard
  13. position="right"
  14. header={t('Examples for %s in current event', <code>{sourceName}</code>)}
  15. body={examples.map(example => (
  16. <pre key={example}>{example}</pre>
  17. ))}
  18. >
  19. <Content>
  20. {t('See Example')} <IconQuestion size="xs" />
  21. </Content>
  22. </ExampleCard>
  23. </Wrapper>
  24. );
  25. export default SourceSuggestionExamples;
  26. const ExampleCard = styled(Hovercard)`
  27. width: 400px;
  28. pre:last-child {
  29. margin: 0;
  30. }
  31. `;
  32. const Content = styled('span')`
  33. display: inline-grid;
  34. grid-template-columns: repeat(2, max-content);
  35. align-items: center;
  36. gap: ${space(0.5)};
  37. color: ${p => p.theme.gray400};
  38. font-size: ${p => p.theme.fontSizeSmall};
  39. text-decoration: underline;
  40. text-decoration-style: dotted;
  41. `;
  42. const Wrapper = styled('div')`
  43. grid-column: 3/3;
  44. `;