Skip to content

Commit

Permalink
UI: Fix hideSearch option
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama committed Jan 4, 2025
1 parent 41aa3d5 commit 18b00c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-maps-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---

Fix `hideSearch` option
11 changes: 7 additions & 4 deletions packages/ui/src/layouts/docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function DocsLayout({
banner: sidebarBanner,
footer: sidebarFooter,
components: sidebarComponents,
hideSearch: sidebarHideSearch,
...sidebar
} = {},
i18n = false,
Expand Down Expand Up @@ -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)',
}}
Expand All @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/layouts/docs/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 18b00c1

Please sign in to comment.