skeleton.scss 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. @include b(skeleton) {
  5. @include set-component-css-var('skeleton', $skeleton);
  6. }
  7. @mixin skeleton-color() {
  8. background: linear-gradient(
  9. 90deg,
  10. getCssVar('skeleton-color') 25%,
  11. getCssVar('skeleton-to-color') 37%,
  12. getCssVar('skeleton-color') 63%
  13. );
  14. background-size: 400% 100%;
  15. animation: #{$namespace}-skeleton-loading 1.4s ease infinite;
  16. }
  17. @keyframes #{$namespace}-skeleton-loading {
  18. 0% {
  19. background-position: 100% 50%;
  20. }
  21. 100% {
  22. background-position: 0 50%;
  23. }
  24. }
  25. @include b(skeleton) {
  26. width: 100%;
  27. @each $unit in (first-line, paragraph) {
  28. @include e($unit) {
  29. height: 16px;
  30. margin-top: 16px;
  31. background: getCssVar('skeleton-color');
  32. }
  33. }
  34. @include when(animated) {
  35. .#{$namespace}-skeleton__item {
  36. @include skeleton-color();
  37. }
  38. }
  39. }