styled.ts 806 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import styled, { css, keyframes } from 'styled-components';
  2. import { color } from '../../constants/style';
  3. const animate = keyframes`
  4. 0% {
  5. opacity: 1;
  6. }
  7. 50% {
  8. opacity: 0.4;
  9. }
  10. 100% {
  11. opacity: 1;
  12. }
  13. `;
  14. const shape: { [index: string]: any } = {
  15. rect: '',
  16. text: css`
  17. margin-top: 8px;
  18. margin-bottom: 8px;
  19. transform-origin: 0 65%;
  20. transform: translateZ(0) scale(1, 0.65);
  21. border-radius: 4px;
  22. text-indent: -999px;
  23. &:empty:before {
  24. content: ' ';
  25. }
  26. `,
  27. circle: css`
  28. border-radius: 50%;
  29. `,
  30. };
  31. export const Element = styled('div')<{ variant: string }>`
  32. display: block;
  33. background-color: ${color.gray};
  34. animation: ${animate} 1.5s ease-in-out infinite;
  35. margin: 5px 0;
  36. ${props => shape[props.variant]}
  37. `;
  38. export default Element;