styled.ts 774 B

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