button-tab.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script setup lang="ts">
  2. import type { PageTabProps } from '../../types';
  3. import style from './index.module.css';
  4. defineOptions({
  5. name: 'ButtonTab'
  6. });
  7. defineProps<PageTabProps>();
  8. type SlotFn = (props?: Record<string, unknown>) => any;
  9. type Slots = {
  10. /**
  11. * Slot
  12. *
  13. * The center content of the tab
  14. */
  15. default?: SlotFn;
  16. /**
  17. * Slot
  18. *
  19. * The left content of the tab
  20. */
  21. prefix?: SlotFn;
  22. /**
  23. * Slot
  24. *
  25. * The right content of the tab
  26. */
  27. suffix?: SlotFn;
  28. };
  29. defineSlots<Slots>();
  30. </script>
  31. <template>
  32. <div
  33. class=":soy: relative inline-flex cursor-pointer items-center justify-center gap-12px whitespace-nowrap border-(1px solid) rounded-4px px-12px py-4px"
  34. :class="[
  35. style['button-tab'],
  36. { [style['button-tab_dark']]: darkMode },
  37. { [style['button-tab_active']]: active },
  38. { [style['button-tab_active_dark']]: active && darkMode }
  39. ]"
  40. >
  41. <slot name="prefix"></slot>
  42. <slot></slot>
  43. <slot name="suffix"></slot>
  44. </div>
  45. </template>
  46. <style scoped></style>