From c66df64cd7ceb42aa2e6bca24fe0fba5dc063972 Mon Sep 17 00:00:00 2001 From: Filip Papiernik <45321473+LeCarteloo@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:06:02 +0100 Subject: [PATCH] OpenAPI: Render Server Selector Only for Multiple Servers (#1065) * OpenAPI: Hide the server selector when there is only one server or none defined * OpenAPI: Improve APIInfo position on smaller screens * docs: Add changeset --- .changeset/red-owls-grab.md | 6 ++++++ packages/openapi/src/ui/client.tsx | 5 +++-- packages/openapi/src/ui/index.tsx | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 .changeset/red-owls-grab.md diff --git a/.changeset/red-owls-grab.md b/.changeset/red-owls-grab.md new file mode 100644 index 000000000..c20c29ab5 --- /dev/null +++ b/.changeset/red-owls-grab.md @@ -0,0 +1,6 @@ +--- +'fumadocs-openapi': minor +--- + +OpenAPI: Display the server selector only when more than one server is defined in the OpenAPI schema +OpenAPI: Improve APIInfo position for better visibility on smaller screens diff --git a/packages/openapi/src/ui/client.tsx b/packages/openapi/src/ui/client.tsx index a78e1e37e..f0998311d 100644 --- a/packages/openapi/src/ui/client.tsx +++ b/packages/openapi/src/ui/client.tsx @@ -76,10 +76,11 @@ export function CopyRouteButton({ export function BaseUrlSelect({ baseUrls }: { baseUrls: string[] }) { const { baseUrl, setBaseUrl } = useApiContext(); - if (baseUrls.length === 0) return null; + + if (baseUrls.length <= 1) return null; return ( -