Secondary.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <SmartLink
  3. :to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
  4. :exact="exact"
  5. :blank="blank"
  6. class="
  7. font-medium
  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. tabindex="0"
  35. >
  36. <i
  37. v-if="icon"
  38. class="material-icons"
  39. :class="[
  40. { '!text-2xl': large },
  41. label ? (reverse ? 'ml-2' : 'mr-2') : '',
  42. ]"
  43. >
  44. {{ icon }}
  45. </i>
  46. <SmartIcon
  47. v-if="svg"
  48. :name="svg"
  49. class="svg-icons"
  50. :class="[
  51. { '!h-6 !w-6': large },
  52. label ? (reverse ? 'ml-2' : 'mr-2') : '',
  53. ]"
  54. />
  55. {{ label }}
  56. <div v-if="shortcut.length" class="ml-2">
  57. <kbd
  58. v-for="(key, index) in shortcut"
  59. :key="`key-${index}`"
  60. class="
  61. bg-dividerLight
  62. rounded
  63. text-secondaryLight
  64. ml-1
  65. px-1
  66. inline-flex
  67. "
  68. >
  69. {{ key }}
  70. </kbd>
  71. </div>
  72. </SmartLink>
  73. </template>
  74. <script lang="ts">
  75. import { defineComponent } from "@nuxtjs/composition-api"
  76. export default defineComponent({
  77. props: {
  78. to: {
  79. type: String,
  80. default: "",
  81. },
  82. exact: {
  83. type: Boolean,
  84. default: true,
  85. },
  86. blank: {
  87. type: Boolean,
  88. default: false,
  89. },
  90. label: {
  91. type: String,
  92. default: "",
  93. },
  94. icon: {
  95. type: String,
  96. default: "",
  97. },
  98. svg: {
  99. type: String,
  100. default: "",
  101. },
  102. color: {
  103. type: String,
  104. default: "",
  105. },
  106. disabled: {
  107. type: Boolean,
  108. default: false,
  109. },
  110. reverse: {
  111. type: Boolean,
  112. default: false,
  113. },
  114. rounded: {
  115. type: Boolean,
  116. default: false,
  117. },
  118. large: {
  119. type: Boolean,
  120. default: false,
  121. },
  122. outline: {
  123. type: Boolean,
  124. default: false,
  125. },
  126. shortcut: {
  127. type: Array,
  128. default: () => [],
  129. },
  130. filled: {
  131. type: Boolean,
  132. default: false,
  133. },
  134. },
  135. })
  136. </script>