Secondary.vue 1.8 KB

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