resourceCard.tsx 1000 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import styled from '@emotion/styled';
  2. import Card from 'sentry/components/card';
  3. import ExternalLink from 'sentry/components/links/externalLink';
  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. <Card interactive>
  13. <StyledLink
  14. href={link}
  15. onClick={() => analytics('orgdash.resource_clicked', {link, title})}
  16. >
  17. <StyledImg src={imgUrl} alt={title} />
  18. <StyledTitle>{title}</StyledTitle>
  19. </StyledLink>
  20. </Card>
  21. );
  22. export default ResourceCard;
  23. const StyledLink = styled(ExternalLink)`
  24. padding: ${space(3)};
  25. flex: 1;
  26. `;
  27. const StyledImg = styled('img')`
  28. display: block;
  29. margin: 0 auto ${space(3)} auto;
  30. height: 160px;
  31. `;
  32. const StyledTitle = styled('div')`
  33. color: ${p => p.theme.textColor};
  34. font-size: ${p => p.theme.fontSizeLarge};
  35. text-align: center;
  36. font-weight: bold;
  37. `;