Skip to content

Commit d51b79e

Browse files
authored
Fix "Search bar is broken on site with sections when header is disabled" (#3624)
1 parent a2720ac commit d51b79e

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

.changeset/two-plants-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Fix Search bar is broken on site with sections when header is disabled

packages/gitbook/src/components/SiteSections/SiteSectionList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function SiteSectionList(props: { sections: ClientSiteSections; className
3838
>
3939
<TOCScrollContainer
4040
style={{ maxHeight: `${MAX_ITEMS * 3 + 2}rem` }}
41-
className="overflow-y-auto px-2 pb-6"
41+
className="overflow-y-auto px-2 pb-4"
4242
>
4343
{sectionsAndGroups.map((item) => {
4444
if (item.object === 'site-section-group') {

packages/gitbook/src/components/SpaceLayout/SpaceLayout.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,16 @@ export function SpaceLayout(props: SpaceLayoutProps) {
149149
// displays the search button and/or the space dropdown in the ToC according to the header/variant settings. E.g if there is no header, the search button will be displayed in the ToC.
150150
<>
151151
{!withTopHeader && (
152-
<SearchContainer
153-
style={CustomizationSearchStyle.Subtle}
154-
isMultiVariants={siteSpaces.length > 1}
155-
spaceTitle={siteSpace.title}
156-
siteSpaceId={siteSpace.id}
157-
className="max-lg:hidden"
158-
viewport="desktop"
159-
/>
152+
<div className="flex gap-2">
153+
<SearchContainer
154+
style={CustomizationSearchStyle.Subtle}
155+
isMultiVariants={siteSpaces.length > 1}
156+
spaceTitle={siteSpace.title}
157+
siteSpaceId={siteSpace.id}
158+
className="max-lg:hidden"
159+
viewport="desktop"
160+
/>
161+
</div>
160162
)}
161163
{!withTopHeader && withSections && sections && (
162164
<SiteSectionList

packages/gitbook/src/components/TableOfContents/TableOfContents.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ export async function TableOfContents(props: {
9696
'page-has-toc:[html.sidebar-filled.circular-corners_&]:rounded-3xl'
9797
)}
9898
>
99-
{innerHeader && <div className="flex px-5 *:my-4">{innerHeader}</div>}
99+
{innerHeader ? (
100+
<div className="my-4 flex flex-col space-y-4 px-5 empty:hidden">
101+
{innerHeader}
102+
</div>
103+
) : null}
100104
<TOCScrollContainer // The scrollview inside the sidebar
101105
className={tcls(
102106
'flex grow flex-col p-2',

0 commit comments

Comments
 (0)