styled.ts 853 B

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