Secondary.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <SmartLink
  3. :to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
  4. :exact="exact"
  5. :blank="blank"
  6. class="
  7. font-semibold
  8. py-2
  9. transition
  10. inline-flex
  11. items-center
  12. justify-center
  13. whitespace-nowrap
  14. hover:bg-primaryDark
  15. focus:outline-none
  16. focus-visible:bg-primaryDark
  17. "
  18. :class="[
  19. color
  20. ? `text-${color}-500 hover:(text-${color}-600 text-${color}-600)`
  21. : 'text-secondary hover:text-secondaryDark focus-visible:text-secondaryDark',
  22. label ? 'rounded px-4' : 'px-2',
  23. { 'rounded-full': rounded },
  24. { 'opacity-75 cursor-not-allowed': disabled },
  25. { 'flex-row-reverse': reverse },
  26. { 'px-6 py-4 text-lg': large },
  27. {
  28. 'border border-divider hover:border-dividerDark focus-visible:border-dividerDark':
  29. outline,
  30. },
  31. { '!bg-primaryDark': filled },
  32. ]"
  33. :disabled="disabled"
  34. >
  35. <i
  36. v-if="icon"
  37. class="material-icons"
  38. :class="[
  39. { '!text-2xl': large },
  40. label ? (reverse ? 'ml-2' : 'mr-2') : '',
  41. ]"
  42. >
  43. {{ icon }}
  44. </i>
  45. <SmartIcon
  46. v-if="svg"
  47. :name="svg"
  48. class="svg-icons"
  49. :class="[
  50. { '!h-6 !w-6': large },
  51. label ? (reverse ? 'ml-2' : 'mr-2') : '',
  52. ]"
  53. />
  54. {{ label }}
  55. <div v-if="shortcut.length" class="ml-2">
  56. <kbd
  57. v-for="(key, index) in shortcut"
  58. :key="`key-${index}`"
  59. class="
  60. bg-dividerLight
  61. rounded
  62. text-secondaryLight
  63. ml-1
  64. px-1
  65. inline-flex
  66. "
  67. >
  68. {{ key }}
  69. </kbd>
  70. </div>
  71. </SmartLink>
  72. </template>
  73. <script lang="ts">
  74. import { defineComponent } from "@nuxtjs/composition-api"
  75. export default defineComponent({
  76. props: {
  77. to: {
  78. type: String,
  79. default: "",
  80. },
  81. exact: {
  82. type: Boolean,
  83. default: true,
  84. },
  85. blank: {
  86. type: Boolean,
  87. default: false,
  88. },
  89. label: {
  90. type: String,
  91. default: "",
  92. },
  93. icon: {
  94. type: String,
  95. default: "",
  96. },
  97. svg: {
  98. type: String,
  99. default: "",
  100. },
  101. color: {
  102. type: String,
  103. default: "",
  104. },
  105. disabled: {
  106. type: Boolean,
  107. default: false,
  108. },
  109. reverse: {
  110. type: Boolean,
  111. default: false,
  112. },
  113. rounded: {
  114. type: Boolean,
  115. default: false,
  116. },
  117. large: {
  118. type: Boolean,
  119. default: false,
  120. },
  121. outline: {
  122. type: Boolean,
  123. default: false,
  124. },
  125. shortcut: {
  126. type: Array,
  127. default: () => [],
  128. },
  129. filled: {
  130. type: Boolean,
  131. default: false,
  132. },
  133. },
  134. })
  135. </script>