PowerSearchEntry.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <div
  3. class="
  4. cursor-pointer
  5. flex
  6. py-2
  7. px-6
  8. transition
  9. items-center
  10. group
  11. focus:outline-none
  12. focus-visible:bg-primaryLight
  13. search-entry
  14. "
  15. :class="{ active, 'focus-visible': active }"
  16. tabindex="-1"
  17. @click="$emit('action', shortcut.action)"
  18. @keydown.enter="$emit('action', shortcut.action)"
  19. >
  20. <SmartIcon
  21. class="mr-4 opacity-50 transition svg-icons group-focus:opacity-100"
  22. :class="{ 'opacity-100 text-secondaryDark': active }"
  23. :name="shortcut.icon"
  24. />
  25. <span
  26. class="flex flex-1 mr-4 transition"
  27. :class="{ 'text-secondaryDark': active }"
  28. >
  29. {{ $t(shortcut.label) }}
  30. </span>
  31. <span
  32. v-for="(key, keyIndex) in shortcut.keys"
  33. :key="`key-${String(keyIndex)}`"
  34. class="shortcut-key"
  35. >
  36. {{ key }}
  37. </span>
  38. </div>
  39. </template>
  40. <script setup lang="ts">
  41. defineProps<{
  42. shortcut: Object
  43. active: Boolean
  44. }>()
  45. </script>
  46. <style lang="scss" scoped>
  47. .search-entry {
  48. @apply relative;
  49. &::after {
  50. @apply absolute;
  51. @apply top-0;
  52. @apply left-0;
  53. @apply bottom-0;
  54. @apply bg-transparent;
  55. @apply z-2;
  56. @apply w-0.5;
  57. @apply transition;
  58. content: "";
  59. }
  60. &.active::after {
  61. @apply bg-accentLight;
  62. }
  63. }
  64. .shortcut-key {
  65. @apply bg-dividerLight;
  66. @apply rounded;
  67. @apply ml-2;
  68. @apply py-1;
  69. @apply px-2;
  70. @apply inline-flex;
  71. }
  72. </style>