UI: Fix hideSearch option

This commit is contained in:
Fuma Nama
2025-01-04 22:53:16 +08:00
parent 41aa3d5259
commit 18b00c1698
3 changed files with 13 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
Fix `hideSearch` option
+7 -4
View File
@@ -66,6 +66,7 @@ export function DocsLayout({
banner: sidebarBanner,
footer: sidebarFooter,
components: sidebarComponents,
hideSearch: sidebarHideSearch,
...sidebar
} = {},
i18n = false,
@@ -120,7 +121,7 @@ export function DocsLayout({
>
{collapsible ? (
<SidebarCollapseTrigger
className="fixed bottom-3 z-30 data-[collapsed=false]:invisible max-md:hidden"
className="fixed bottom-3 z-30 data-[collapsed=false]:hidden max-md:hidden"
style={{
insetInlineStart: 'calc(var(--fd-layout-offset) + 0.5rem)',
}}
@@ -141,9 +142,11 @@ export function DocsLayout({
{tabs.length > 0 ? (
<RootToggle options={tabs} className="-mx-2" />
) : null}
<SearchOnly>
<LargeSearchToggle className="rounded-lg max-md:hidden" />
</SearchOnly>
{!sidebarHideSearch ? (
<SearchOnly>
<LargeSearchToggle className="rounded-lg max-md:hidden" />
</SearchOnly>
) : null}
</SidebarHeader>
<SidebarViewport>
<div className="pt-4 empty:hidden md:hidden">
+1 -1
View File
@@ -38,7 +38,7 @@ export interface SidebarOptions extends SidebarProps {
footer?: ReactNode;
/**
* Hide search trigger
* Hide search trigger. You can also disable search for the entire site from `<RootProvider />`.
*
* @defaultValue false
*/