* Copy the design-system app into a new one for ui-library. * Remove unneeded content. * Add supabase config. * Cleanup the css. * Add bunch of packages. * Cleanup the registry. * Regenerate the registry. * Add needed components for documenting components. * Add the pages for the components. * Fix the RegistryBlock. * Various fixes. * Add a turbo definition for ui-library. * Rename Remix to React Router. * Reorder the pages for all frameworks. * Remove the bottom pager. * Fix the pages and command menu. * Various fixes. * Minor fixes. * Add ai editor rules. * Various fixes. * Add local supabase env vars. * Try to fix a package error. * Bunch of various fixes. * Fix lint errors.
59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import fs from 'fs'
|
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui'
|
|
// import { parse } from 'react-docgen'
|
|
|
|
export function ComponentProps(props: any) {
|
|
// map through all props types for this component DropdownMenu
|
|
// return a table with the prop name, type, default value, and description
|
|
|
|
// const code = `
|
|
// /** My first component */
|
|
// export default ({ name }: { name: string }) => <div>{{name}}</div>;
|
|
// `
|
|
|
|
// const documentation = parse(code)
|
|
//
|
|
// console.log(documentation)
|
|
|
|
// console.log('from the component props', JSON.parse(props.docs))
|
|
|
|
const docs = JSON.parse(props.docs)
|
|
|
|
// console.log(docs.props)
|
|
|
|
return (
|
|
<div className="space-y-2">
|
|
<p className="font-medium text-foreground-light">{props.children}</p>
|
|
|
|
<Table>
|
|
<TableHeader>
|
|
<TableRow>
|
|
<TableHead className="font-mono uppercase text-xs font-normal">Prop Name</TableHead>
|
|
<TableHead className="font-mono uppercase text-xs font-normal">Required</TableHead>
|
|
<TableHead className="font-mono uppercase text-xs font-normal">Type</TableHead>
|
|
<TableHead className="font-mono uppercase text-xs text-right font-normal">
|
|
Description
|
|
</TableHead>
|
|
</TableRow>
|
|
</TableHeader>
|
|
<TableBody>
|
|
{Object.entries(docs.props).map(([propName, prop], index) => (
|
|
<TableRow key={index}>
|
|
<TableCell>{propName}</TableCell>
|
|
{/*
|
|
// @ts-ignore */}
|
|
<TableCell>{prop.required ? 'Yes' : 'No'}</TableCell>
|
|
{/*
|
|
// @ts-ignore */}
|
|
<TableCell>{prop.flowType.name}</TableCell>
|
|
{/*
|
|
// @ts-ignore */}
|
|
<TableCell className="text-right">{prop.description}</TableCell>
|
|
</TableRow>
|
|
))}
|
|
</TableBody>
|
|
</Table>
|
|
</div>
|
|
)
|
|
}
|