skeleton.scss 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. @use "../utilities/css-variables" as cv;
  2. @use "../utilities/initial-variables" as iv;
  3. @use "../utilities/mixins" as mx;
  4. @use "../utilities/extends";
  5. $skeleton-background: cv.getVar("border") !default;
  6. $skeleton-radius: cv.getVar("radius-small") !default;
  7. $skeleton-block-min-height: 4.5em !default;
  8. $skeleton-lines-gap: 0.75em !default;
  9. $skeleton-line-height: 0.75em !default;
  10. :root {
  11. @include cv.register-vars(
  12. (
  13. "skeleton-background": #{$skeleton-background},
  14. "skeleton-radius": #{$skeleton-radius},
  15. "skeleton-block-min-height": #{$skeleton-block-min-height},
  16. "skeleton-lines-gap": #{$skeleton-lines-gap},
  17. "skeleton-line-height": #{$skeleton-line-height},
  18. )
  19. );
  20. }
  21. %skeleton-pulsation {
  22. animation-duration: 2s;
  23. animation-iteration-count: infinite;
  24. animation-name: pulsate;
  25. animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
  26. background-color: cv.getVar("skeleton-background");
  27. border-radius: cv.getVar("skeleton-radius");
  28. box-shadow: none;
  29. pointer-events: none;
  30. }
  31. .#{iv.$class-prefix}is-skeleton {
  32. @extend %skeleton-pulsation;
  33. color: transparent !important;
  34. em,
  35. strong {
  36. color: inherit;
  37. }
  38. img {
  39. visibility: hidden;
  40. }
  41. &.#{iv.$class-prefix}checkbox {
  42. input {
  43. opacity: 0;
  44. }
  45. }
  46. &.#{iv.$class-prefix}delete {
  47. border-radius: cv.getVar("radius-rounded");
  48. &::before,
  49. &::after {
  50. display: none;
  51. }
  52. }
  53. }
  54. input.#{iv.$class-prefix}is-skeleton,
  55. textarea.#{iv.$class-prefix}is-skeleton {
  56. resize: none;
  57. @include mx.placeholder {
  58. color: transparent !important;
  59. }
  60. }
  61. .#{iv.$class-prefix}has-skeleton {
  62. color: transparent !important;
  63. position: relative;
  64. &::after {
  65. @extend %skeleton-pulsation;
  66. content: "";
  67. display: block;
  68. height: 100%;
  69. left: 0;
  70. max-width: 100%;
  71. min-width: 10%;
  72. position: absolute;
  73. top: 0;
  74. width: 7em;
  75. }
  76. }
  77. .#{iv.$class-prefix}skeleton-block {
  78. @extend %block;
  79. @extend %skeleton-pulsation;
  80. color: transparent !important;
  81. min-height: cv.getVar("skeleton-block-min-height");
  82. }
  83. .#{iv.$class-prefix}skeleton-lines {
  84. color: transparent !important;
  85. display: flex;
  86. flex-direction: column;
  87. gap: cv.getVar("skeleton-lines-gap");
  88. position: relative;
  89. > div {
  90. @extend %skeleton-pulsation;
  91. height: cv.getVar("skeleton-line-height");
  92. &:last-child {
  93. min-width: 4em;
  94. width: 30%;
  95. }
  96. }
  97. }