SearchResultPlaceholder.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <template>
  2. <svg
  3. class="unified-search__result-placeholder"
  4. xmlns="http://www.w3.org/2000/svg"
  5. fill="url(#unified-search__result-placeholder-gradient)">
  6. <defs>
  7. <linearGradient id="unified-search__result-placeholder-gradient">
  8. <stop offset="0%" stop-color="#ededed"><animate attributeName="stop-color"
  9. values="#ededed; #ededed; #cccccc; #cccccc; #ededed"
  10. dur="2s"
  11. repeatCount="indefinite" /></stop>
  12. <stop offset="100%" stop-color="#cccccc"><animate attributeName="stop-color"
  13. values="#cccccc; #ededed; #ededed; #cccccc; #cccccc"
  14. dur="2s"
  15. repeatCount="indefinite" /></stop>
  16. </linearGradient>
  17. </defs>
  18. <rect class="unified-search__result-placeholder-icon" />
  19. <rect class="unified-search__result-placeholder-line-one" />
  20. <rect class="unified-search__result-placeholder-line-two" :style="{width: `calc(${randWidth}%)`}" />
  21. </svg>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'SearchResultPlaceholder',
  26. data() {
  27. return {
  28. randWidth: Math.floor(Math.random() * 20) + 30,
  29. }
  30. },
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. $clickable-area: 44px;
  35. $margin: 10px;
  36. .unified-search__result-placeholder {
  37. width: calc(100% - 2 * #{$margin});
  38. height: $clickable-area;
  39. margin: $margin;
  40. &-icon {
  41. width: $clickable-area;
  42. height: $clickable-area;
  43. rx: var(--border-radius);
  44. ry: var(--border-radius);
  45. }
  46. &-line-one,
  47. &-line-two {
  48. width: calc(100% - #{$margin + $clickable-area});
  49. height: 1em;
  50. x: $margin + $clickable-area;
  51. }
  52. &-line-one {
  53. y: 5px;
  54. }
  55. &-line-two {
  56. y: 25px;
  57. }
  58. }
  59. </style>