resourceCard.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import styled from '@emotion/styled';
  2. import ExternalLink from 'sentry/components/links/externalLink';
  3. import {Panel} from 'sentry/components/panels';
  4. import space from 'sentry/styles/space';
  5. import {analytics} from 'sentry/utils/analytics';
  6. type Props = {
  7. imgUrl: string;
  8. link: string;
  9. title: string;
  10. };
  11. const ResourceCard = ({title, link, imgUrl}: Props) => (
  12. <ResourceCardWrapper
  13. onClick={() => analytics('orgdash.resource_clicked', {link, title})}
  14. >
  15. <StyledLink href={link}>
  16. <StyledImg src={imgUrl} alt={title} />
  17. <StyledTitle>{title}</StyledTitle>
  18. </StyledLink>
  19. </ResourceCardWrapper>
  20. );
  21. export default ResourceCard;
  22. const ResourceCardWrapper = styled(Panel)`
  23. display: flex;
  24. flex: 1;
  25. align-items: center;
  26. padding: ${space(3)};
  27. margin-bottom: 0;
  28. `;
  29. const StyledLink = styled(ExternalLink)`
  30. flex: 1;
  31. `;
  32. const StyledImg = styled('img')`
  33. display: block;
  34. margin: 0 auto ${space(3)} auto;
  35. height: 160px;
  36. `;
  37. const StyledTitle = styled('div')`
  38. color: ${p => p.theme.textColor};
  39. font-size: ${p => p.theme.fontSizeLarge};
  40. text-align: center;
  41. font-weight: bold;
  42. `;