import React, { ReactElement } from 'react'; import Layout from '../components/layout'; import style from '../styles/lists.module.css'; import res from '../public/resources.yaml'; type listItem = { children?: listItem[] | string[]; url?: string; title: string; description?: string }; const list: listItem[] = res; function mapChild(obj: listItem | string, level: number) { if (typeof obj === 'string') { if (obj === '') return <>> return {obj} } if (obj.title === '') return <>> if (obj.url) return {obj.title} if (!obj.children) return {obj.title} let title: ReactElement; if (level >= 0 && level <= 4) title = React.createElement(`h${level + 2}`, {}, obj.title); else title = React.createElement('strong', {}, obj.title); return ( <> {title} {obj.description ?
{obj.description}
: <>>}