PowerSearchEntry.vue 1.4 KB

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