Skip to content

Commit 5844c6f

Browse files
committed
UI: no longer sort type table properties by default
1 parent 1e50889 commit 5844c6f

File tree

3 files changed

+45
-44
lines changed

3 files changed

+45
-44
lines changed

.changeset/pink-schools-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'fumadocs-ui': patch
3+
---
4+
5+
no longer sort type table properties by default

packages/openapi/src/ui/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export function ObjectCollapsible(props: {
128128
children: ReactNode;
129129
}) {
130130
return (
131-
<Collapsible {...props}>
131+
<Collapsible className="my-2" {...props}>
132132
<CollapsibleTrigger
133133
className={cn(
134134
buttonVariants({ color: 'secondary', size: 'sm' }),

packages/ui/src/components/type-table.tsx

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -66,49 +66,45 @@ export function TypeTable({ type }: { type: Record<string, ObjectType> }) {
6666
</tr>
6767
</thead>
6868
<tbody>
69-
{Object.entries(type)
70-
.sort((a) => (a[1].deprecated ? 1 : -1))
71-
.map(([key, value]) => (
72-
<tr key={key}>
73-
<td>
74-
<div className={field()}>
75-
<code
76-
className={cn(
77-
code({
78-
color: value.deprecated ? 'deprecated' : 'primary',
79-
}),
80-
)}
81-
>
82-
{key}
83-
{!value.required && '?'}
84-
</code>
85-
{value.description ? (
86-
<Info>{value.description}</Info>
87-
) : null}
88-
</div>
89-
</td>
90-
<td>
91-
<div className={field()}>
92-
<code className={code()}>{value.type}</code>
93-
{value.typeDescription ? (
94-
<Info>{value.typeDescription}</Info>
95-
) : null}
96-
{value.typeDescriptionLink ? (
97-
<Link href={value.typeDescriptionLink}>
98-
<InfoIcon className="size-4" />
99-
</Link>
100-
) : null}
101-
</div>
102-
</td>
103-
<td>
104-
{value.default ? (
105-
<code className={code()}>{value.default}</code>
106-
) : (
107-
'-'
108-
)}
109-
</td>
110-
</tr>
111-
))}
69+
{Object.entries(type).map(([key, value]) => (
70+
<tr key={key}>
71+
<td>
72+
<div className={field()}>
73+
<code
74+
className={cn(
75+
code({
76+
color: value.deprecated ? 'deprecated' : 'primary',
77+
}),
78+
)}
79+
>
80+
{key}
81+
{!value.required && '?'}
82+
</code>
83+
{value.description ? <Info>{value.description}</Info> : null}
84+
</div>
85+
</td>
86+
<td>
87+
<div className={field()}>
88+
<code className={code()}>{value.type}</code>
89+
{value.typeDescription ? (
90+
<Info>{value.typeDescription}</Info>
91+
) : null}
92+
{value.typeDescriptionLink ? (
93+
<Link href={value.typeDescriptionLink}>
94+
<InfoIcon className="size-4" />
95+
</Link>
96+
) : null}
97+
</div>
98+
</td>
99+
<td>
100+
{value.default ? (
101+
<code className={code()}>{value.default}</code>
102+
) : (
103+
'-'
104+
)}
105+
</td>
106+
</tr>
107+
))}
112108
</tbody>
113109
</table>
114110
</div>

0 commit comments

Comments
 (0)