Secondary.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <SmartLink
  3. :to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
  4. :exact="exact"
  5. :blank="blank"
  6. class="hover:translate-x-2 focus:outline-none focus-visible:translate-x-2 inline-flex items-center flex-1 py-2 font-semibold truncate transition transform"
  7. :class="[
  8. label ? 'px-3' : '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. {{ label }}
  36. </SmartLink>
  37. </template>
  38. <script>
  39. import { defineComponent } from "@nuxtjs/composition-api"
  40. export default defineComponent({
  41. props: {
  42. to: {
  43. type: String,
  44. default: "",
  45. },
  46. exact: {
  47. type: Boolean,
  48. default: true,
  49. },
  50. blank: {
  51. type: Boolean,
  52. default: false,
  53. },
  54. label: {
  55. type: String,
  56. default: "",
  57. },
  58. icon: {
  59. type: String,
  60. default: "",
  61. },
  62. svg: {
  63. type: String,
  64. default: "",
  65. },
  66. color: {
  67. type: String,
  68. default: "",
  69. },
  70. active: {
  71. type: Boolean,
  72. default: false,
  73. },
  74. disabled: {
  75. type: Boolean,
  76. default: false,
  77. },
  78. },
  79. })
  80. </script>