AppButton.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <Component :is="'button'"
  3. class="inline-flex gap-0.5 justify-center overflow-hidden text-sm font-medium transition"
  4. :class="[ variantStyles[ variant ] ]">
  5. <IconsArrow
  6. v-if="arrow === 'left'"
  7. class="mt-0.5 h-5 w-5"
  8. :class="{
  9. 'relative top-px': variant === 'text',
  10. '-ml-1 rotate-180': arrow === 'left',
  11. '-mr-1': arrow === 'right'
  12. }"/>
  13. <slot/>
  14. <IconsArrow
  15. v-if="arrow === 'right'"
  16. class="mt-0.5 h-5 w-5"
  17. :class="{
  18. 'relative top-px': variant === 'text',
  19. '-ml-1 rotate-180': arrow === 'left',
  20. '-mr-1': arrow === 'right'
  21. }"/>
  22. </Component>
  23. </template>
  24. <script setup>
  25. const props = defineProps({
  26. variant: {
  27. default: 'primary'
  28. },
  29. arrow: {
  30. default: ''
  31. },
  32. href: {
  33. default: ''
  34. }
  35. })
  36. const variantStyles = ref({
  37. primary: 'rounded-full py-1 px-3 bg-emerald-400/10 text-emerald-400 ring-1 ring-inset ring-emerald-400/20 hover:bg-emerald-400/10 hover:text-emerald-300 hover:ring-emerald-300',
  38. secondary: 'rounded-full py-1 px-3 ring-1 ring-inset ring-zinc-800 hover:bg-zinc-800 hover:text-zinc-300',
  39. filled: 'rounded-full py-1 px-3 text-white bg-emerald-500 hover:bg-emerald-400',
  40. outline: 'rounded-full py-1 px-3 ring-1 ring-inset text-zinc-400 ring-white/10 hover:bg-white/5 hover:text-white',
  41. text: 'text-emerald-400 hover:text-emerald-500',
  42. })
  43. </script>