import { NAlert, NH4, NP } from 'naive-ui'

export interface Xaml {
  name: string
  message: string
  subXamls: Xaml[]
}

export function createXamlBlock(xamls: Xaml[]) {
  return (
    <>
      {xamls.map((xaml) => {
        return (
          <div class="xaml-block">
            <NH4 class="title">{xaml.name}</NH4>
            <NP class="text">{xaml.message}</NP>
            {createXamlBlock(xaml.subXamls)}
          </div>
        )
      })}
    </>
  )
}

export function createErrorBlock(msg: string) {
  return (
    <NAlert type="error" title="可视化失败……">
      {msg}
    </NAlert>
  )
}
