UI: no longer sort type table properties by default

This commit is contained in:
Fuma Nama
2025-07-08 16:04:45 +08:00
parent 1e508893de
commit 5844c6f382
3 changed files with 45 additions and 44 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
no longer sort type table properties by default
+1 -1
View File
@@ -128,7 +128,7 @@ export function ObjectCollapsible(props: {
children: ReactNode;
}) {
return (
<Collapsible {...props}>
<Collapsible className="my-2" {...props}>
<CollapsibleTrigger
className={cn(
buttonVariants({ color: 'secondary', size: 'sm' }),
+39 -43
View File
@@ -66,49 +66,45 @@ export function TypeTable({ type }: { type: Record<string, ObjectType> }) {
</tr>
</thead>
<tbody>
{Object.entries(type)
.sort((a) => (a[1].deprecated ? 1 : -1))
.map(([key, value]) => (
<tr key={key}>
<td>
<div className={field()}>
<code
className={cn(
code({
color: value.deprecated ? 'deprecated' : 'primary',
}),
)}
>
{key}
{!value.required && '?'}
</code>
{value.description ? (
<Info>{value.description}</Info>
) : null}
</div>
</td>
<td>
<div className={field()}>
<code className={code()}>{value.type}</code>
{value.typeDescription ? (
<Info>{value.typeDescription}</Info>
) : null}
{value.typeDescriptionLink ? (
<Link href={value.typeDescriptionLink}>
<InfoIcon className="size-4" />
</Link>
) : null}
</div>
</td>
<td>
{value.default ? (
<code className={code()}>{value.default}</code>
) : (
'-'
)}
</td>
</tr>
))}
{Object.entries(type).map(([key, value]) => (
<tr key={key}>
<td>
<div className={field()}>
<code
className={cn(
code({
color: value.deprecated ? 'deprecated' : 'primary',
}),
)}
>
{key}
{!value.required && '?'}
</code>
{value.description ? <Info>{value.description}</Info> : null}
</div>
</td>
<td>
<div className={field()}>
<code className={code()}>{value.type}</code>
{value.typeDescription ? (
<Info>{value.typeDescription}</Info>
) : null}
{value.typeDescriptionLink ? (
<Link href={value.typeDescriptionLink}>
<InfoIcon className="size-4" />
</Link>
) : null}
</div>
</td>
<td>
{value.default ? (
<code className={code()}>{value.default}</code>
) : (
'-'
)}
</td>
</tr>
))}
</tbody>
</table>
</div>