import { makeComponentProps } from '@/composables/component'
import { makeTagProps } from '@/composables/tag'

import { genericComponent, propsFactory } from '@/utils'

import { consoleWarn } from '@/utils'

export const makeUExampleComponentProps = propsFactory(
  {
    type: {
      type: String,
      default: 'example',
    },

    ...makeComponentProps(),
    ...makeTagProps(),
  },
  'UExampleComponent'
)

export type UExampleComponentSlots = {
  default: never
}

export const UExampleComponent = genericComponent<UExampleComponentSlots>()({
  name: 'UExampleComponent',

  props: makeUExampleComponentProps(),

  setup(props, { slots }) {
    const type = props.type
    if (type === 'example') {
      console.log('Hey')
    }

    return () => (
      <div data-type={props.type} class="w-full">
        {slots.default?.()}
      </div>
    )
  },
})

export type UExampleComponent = InstanceType<typeof UExampleComponent>
