circleIndicator.tsx 506 B

123456789101112131415161718192021222324252627
  1. import styled from '@emotion/styled';
  2. type Props = {
  3. color?: string;
  4. enabled?: boolean;
  5. size?: number;
  6. };
  7. const getSize = (p: Props) => `
  8. height: ${p.size}px;
  9. width: ${p.size}px;
  10. `;
  11. const CircleIndicator = styled('div')<Props>`
  12. display: inline-block;
  13. position: relative;
  14. border-radius: 50%;
  15. ${getSize};
  16. background: ${p => p.color ?? (p.enabled ? p.theme.success : p.theme.error)};
  17. `;
  18. CircleIndicator.defaultProps = {
  19. enabled: true,
  20. size: 14,
  21. };
  22. export default CircleIndicator;