Primary.vue 1.6 KB

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