FeaturesItem.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import React, { FC } from "react";
  2. import styled from "styled-components";
  3. import { Flex } from "reflexbox/styled-components";
  4. import { fadeIn } from "../helpers/animations";
  5. interface Props {
  6. title: string;
  7. icon: string; // TODO: better typing
  8. }
  9. const Block = styled(Flex).attrs({
  10. maxWidth: ["100%", "100%", "50%", "25%"],
  11. flexDirection: "column",
  12. alignItems: "center",
  13. p: "0 24px",
  14. mb: [48, 48, 48, 0]
  15. })`
  16. animation: ${fadeIn} 0.8s ease-out;
  17. :last-child {
  18. margin-right: 0;
  19. }
  20. `;
  21. const IconBox = styled(Flex).attrs({
  22. width: [40, 40, 48],
  23. height: [40, 40, 48],
  24. alignItems: "center",
  25. justifyContent: "center"
  26. })`
  27. border-radius: 100%;
  28. box-sizing: border-box;
  29. background-color: #2196f3;
  30. `;
  31. const Icon = styled.img`
  32. display: inline-block;
  33. width: 16px;
  34. height: 16px;
  35. margin: 0;
  36. padding: 0;
  37. @media only screen and (max-width: 448px) {
  38. width: 14px;
  39. height: 14px;
  40. }
  41. `;
  42. const Title = styled.h3`
  43. margin: 16px;
  44. font-size: 15px;
  45. @media only screen and (max-width: 448px) {
  46. margin: 12px;
  47. font-size: 14px;
  48. }
  49. `;
  50. const Description = styled.p`
  51. margin: 0;
  52. font-size: 14px;
  53. font-weight: 300;
  54. text-align: center;
  55. @media only screen and (max-width: 448px) {
  56. font-size: 13px;
  57. }
  58. `;
  59. const FeaturesItem: FC<Props> = ({ children, icon, title }) => (
  60. <Block>
  61. <IconBox>
  62. <Icon src={`/images/${icon}.svg`} />
  63. </IconBox>
  64. <Title>{title}</Title>
  65. <Description>{children}</Description>
  66. </Block>
  67. );
  68. export default FeaturesItem;