PowerSearchEntry.vue 1.5 KB

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