Round.js 725 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import React, { memo } from "react";
  2. import styled, { css } from "styled-components";
  3. const StyledRound = styled.div`
  4. ${({ radius = 50, color = "#ccc" }) => css`
  5. border-radius: 100%;
  6. width: ${radius}px;
  7. height: ${radius}px;
  8. background-color: ${color};
  9. text-align: center;
  10. display: flex;
  11. align-items: center;
  12. justify-content: center;
  13. `}
  14. `;
  15. const Round = ({
  16. radius,
  17. color,
  18. text = "",
  19. textColor = "#000",
  20. fontSize = "16",
  21. }) => {
  22. return (
  23. <StyledRound radius={radius} color={color}>
  24. <span
  25. style={{
  26. textColor,
  27. fontSize: fontSize + "px",
  28. }}
  29. >
  30. {text}
  31. </span>
  32. </StyledRound>
  33. );
  34. };
  35. export default memo(Round);