PowerSearchEntry.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <button
  3. class="cursor-pointer flex flex-1 py-2 px-6 transition items-center 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 font-medium 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: Object
  34. active: Boolean
  35. }>()
  36. </script>
  37. <style lang="scss" scoped>
  38. .search-entry {
  39. @apply relative;
  40. &::after {
  41. @apply absolute;
  42. @apply top-0;
  43. @apply left-0;
  44. @apply bottom-0;
  45. @apply bg-transparent;
  46. @apply z-2;
  47. @apply w-0.5;
  48. @apply transition;
  49. content: "";
  50. }
  51. &.active {
  52. @apply outline-none;
  53. @apply bg-primaryLight;
  54. &::after {
  55. @apply bg-accentLight;
  56. }
  57. }
  58. }
  59. .shortcut-key {
  60. @apply bg-dividerLight;
  61. @apply rounded;
  62. @apply ml-2;
  63. @apply py-1;
  64. @apply px-2;
  65. @apply inline-flex;
  66. }
  67. </style>