Secondary.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <SmartLink
  3. :to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
  4. :exact="exact"
  5. :blank="blank"
  6. class="
  7. font-medium
  8. flex-1
  9. py-2
  10. transition
  11. transform
  12. inline-flex
  13. items-center
  14. truncate
  15. hover:translate-x-2
  16. focus:outline-none
  17. focus-visible:translate-x-2
  18. "
  19. :class="[
  20. label ? 'px-3' : 'px-2',
  21. active
  22. ? color
  23. ? `text-${color}-500 hover:text-${color}-600 focus-visible:text-${color}-600`
  24. : 'text-accent hover:text-accentDark focus-visible:text-accentDark'
  25. : 'hover:text-secondaryDark focus-visible:text-secondaryDark',
  26. color
  27. ? `text-${color}-500 hover:text-${color}-600 focus-visible:text-${color}-600`
  28. : '',
  29. { 'opacity-75 cursor-not-allowed': disabled },
  30. ]"
  31. :disabled="disabled"
  32. type="button"
  33. >
  34. <i
  35. v-if="icon"
  36. :class="label ? 'mr-4 opacity-75' : ''"
  37. class="material-icons"
  38. >
  39. {{ icon }}
  40. </i>
  41. <SmartIcon
  42. v-if="svg"
  43. :name="svg"
  44. :class="label ? 'mr-4 opacity-75' : ''"
  45. class="svg-icons"
  46. />
  47. {{ label }}
  48. </SmartLink>
  49. </template>
  50. <script>
  51. import { defineComponent } from "@nuxtjs/composition-api"
  52. export default defineComponent({
  53. props: {
  54. to: {
  55. type: String,
  56. default: "",
  57. },
  58. exact: {
  59. type: Boolean,
  60. default: true,
  61. },
  62. blank: {
  63. type: Boolean,
  64. default: false,
  65. },
  66. label: {
  67. type: String,
  68. default: "",
  69. },
  70. icon: {
  71. type: String,
  72. default: "",
  73. },
  74. svg: {
  75. type: String,
  76. default: "",
  77. },
  78. color: {
  79. type: String,
  80. default: "",
  81. },
  82. active: {
  83. type: Boolean,
  84. default: false,
  85. },
  86. disabled: {
  87. type: Boolean,
  88. default: false,
  89. },
  90. },
  91. })
  92. </script>