import type { App } from 'vue'

const modules = import.meta.glob('./form/*.vue', { eager: true })
import { System, Check, MenuFoldOne, MenuUnfoldOne, Logout, SettingTwo } from '@icon-park/vue-next'

function registerComponent(app: App): void {
  for (const key in modules) {
    const name = key.replace(/^\.\/form\/|\.vue/g, '')
    const component = (modules[key] as any).default
    app.component('El' + name, component)
  }

  app.component('icon-system', System)
  app.component('icon-check', Check)
  app.component('icon-menu-fold-one', MenuFoldOne)
  app.component('icon-menu-unfold-one', MenuUnfoldOne)
  app.component('icon-logout', Logout)
  app.component('icon-setting-two', SettingTwo)
}

export default registerComponent
