FeaturesItem.tsx 1.4 KB

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