OpenAPI: Improve UI

This commit is contained in:
fuma-nama
2024-08-04 00:26:25 +08:00
parent ea15b78d62
commit b109e44715
3 changed files with 8 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': minor
---
Improve generated sample requests
-10
View File
@@ -13,16 +13,6 @@ void OpenAPI.generateFiles({
input: ['./*.yaml'],
output: './content/docs/ui',
per: 'operation',
renderer: {
Root(props, child) {
return OpenAPI.createElement(
'Root',
props,
'<div className="bg-fd-secondary p-4 rounded-lg">Demo Only</div>',
...child,
);
},
},
});
const demoRegex = /^---type-table-demo---\r?\n(?<content>.+)\r?\n---end---$/gm;
+3 -3
View File
@@ -85,10 +85,10 @@ export function APIInfo({
...props
}: APIInfoProps): React.ReactElement {
return (
<div className={cn('min-w-0 flex-1 prose-no-margin', className)} {...props}>
<div className={cn('min-w-0 flex-1', className)} {...props}>
<div
className={cn(
'sticky top-24 z-[2] flex flex-row items-center gap-2 rounded-lg border bg-fd-card p-3 md:top-10',
'sticky top-24 z-[2] mb-4 flex flex-row items-center gap-2 rounded-lg border bg-fd-card p-3 md:top-10',
)}
>
<span
@@ -104,7 +104,7 @@ export function APIInfo({
<CopyRouteButton className="ms-auto size-6 p-1" route={route} />
</div>
{children}
<div className="prose-no-margin">{children}</div>
</div>
);
}