Skip to content

Commit 3817289

Browse files
authored
Fix overflowing section groups (#3873)
1 parent 4690e20 commit 3817289

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.changeset/full-coats-shave.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 overflowing section groups

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
} from './encodeClientSiteSections';
1919

2020
const SCREEN_OFFSET = 16; // 1rem
21-
const MAX_ITEMS_PER_COLUMN = 5; // number of items per column
21+
const MAX_ITEMS_PER_COLUMN = 8; // number of items per column
2222
/**
2323
* A set of navigational links representing site sections for multi-section sites
2424
*/
@@ -223,7 +223,7 @@ function SectionGroupTileList(props: {
223223
{hasSections && (
224224
<ul
225225
className={tcls(
226-
'flex grid-flow-row flex-col gap-x-2 gap-y-1 p-2 md:grid',
226+
'flex min-w-48 grid-flow-row flex-col gap-x-2 gap-y-1 self-start p-3 md:grid',
227227
hasGroups ? 'bg-tint-base' : ''
228228
)}
229229
style={{
@@ -244,7 +244,7 @@ function SectionGroupTileList(props: {
244244
{hasGroups && (
245245
<ul
246246
className={tcls(
247-
'flex grid-flow-col flex-col items-start gap-x-2 gap-y-4 p-2 md:grid md:gap-y-1',
247+
'flex min-w-48 flex-col items-start justify-start gap-x-8 gap-y-2 p-3 md:flex-row md:gap-y-8',
248248
hasSections
249249
? 'border-tint-subtle bg-tint-subtle max-md:border-t md:border-l'
250250
: ''
@@ -276,7 +276,7 @@ function SectionGroupTile(props: {
276276
const { url, icon, title, description } = child;
277277
const isActive = child.id === currentSection.id;
278278
return (
279-
<li className="group/section-tile flex w-full shrink grow md:w-68">
279+
<li className="group/section-tile flex shrink-0 grow md:max-w-68">
280280
<Link
281281
href={url}
282282
className={tcls(
@@ -317,7 +317,7 @@ function SectionGroupTile(props: {
317317
const { title, icon, children } = child;
318318

319319
return (
320-
<li className="flex w-full shrink grow flex-col gap-1">
320+
<li className="flex shrink-0 flex-col gap-1">
321321
<div className="mt-3 mb-2 flex gap-2.5 px-3 font-semibold text-tint-subtle text-xs uppercase tracking-wider">
322322
{icon && (
323323
<SectionIcon className="mt-0.5" isActive={false} icon={icon as IconName} />
@@ -327,7 +327,7 @@ function SectionGroupTile(props: {
327327
<ul
328328
className="flex grid-flow-row flex-col gap-x-2 gap-y-1 md:grid"
329329
style={{
330-
gridTemplateColumns: `repeat(${Math.ceil(children.length / MAX_ITEMS_PER_COLUMN)}, minmax(0, 1fr))`,
330+
gridTemplateColumns: `repeat(${Math.ceil(children.length / MAX_ITEMS_PER_COLUMN)}, minmax(0, auto))`,
331331
}}
332332
>
333333
{children.map((nestedChild) => (

0 commit comments

Comments
 (0)