PowerSearchEntry.vue 1.4 KB

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