iconEntry.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import styled from '@emotion/styled';
  2. import {Hovercard} from 'sentry/components/hovercard';
  3. import space from 'sentry/styles/space';
  4. import Details from './details';
  5. import IconSample from './sample';
  6. import {ExtendedIconData} from './searchPanel';
  7. type Props = {
  8. icon: ExtendedIconData;
  9. };
  10. const IconEntry = ({icon}: Props) => {
  11. return (
  12. <Hovercard body={<Details icon={icon} />}>
  13. <BoxWrap>
  14. <IconSample name={icon.name} size="sm" color="gray500" {...icon.defaultProps} />
  15. <Name>{icon.name}</Name>
  16. </BoxWrap>
  17. </Hovercard>
  18. );
  19. };
  20. export default IconEntry;
  21. const BoxWrap = styled('div')`
  22. display: flex;
  23. align-items: center;
  24. gap: ${space(1)};
  25. padding: ${space(1)};
  26. border: solid 1px transparent;
  27. border-radius: ${p => p.theme.borderRadius};
  28. cursor: pointer;
  29. svg {
  30. flex-shrink: 0;
  31. width: 24px;
  32. }
  33. &:hover {
  34. border-color: ${p => p.theme.innerBorder};
  35. }
  36. `;
  37. const Name = styled('p')`
  38. position: relative;
  39. line-height: 1;
  40. margin-bottom: 0;
  41. font-size: ${p => p.theme.fontSizeMedium};
  42. text-transform: capitalize;
  43. `;