Skip to content

Commit 2dfd5aa

Browse files
conico974Nicolas Dorseuil
andauthored
Update SpacesDropdown to manage active state based on current space (#3356)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
1 parent 8d3c656 commit 2dfd5aa

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

packages/gitbook/e2e/customers.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ const testCases: TestsCase[] = [
117117
contentBaseURL: 'https://docs.gradient.network',
118118
tests: [{ name: 'Home', url: '/' }],
119119
},
120-
{
121-
name: 'mygate-network.gitbook.io',
122-
contentBaseURL: 'https://mygate-network.gitbook.io',
123-
tests: [{ name: 'Home', url: '/' }],
124-
},
120+
// {
121+
// name: 'mygate-network.gitbook.io',
122+
// contentBaseURL: 'https://mygate-network.gitbook.io',
123+
// tests: [{ name: 'Home', url: '/' }],
124+
// },
125125
{
126126
name: 'treasurenft.gitbook.io',
127127
contentBaseURL: 'https://treasurenft.gitbook.io',

packages/gitbook/src/components/Header/SpacesDropdown.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export function SpacesDropdown(props: {
7070
id: space.id,
7171
title: space.title,
7272
url: getSiteSpaceURL(context, space),
73+
isActive: space.id === siteSpace.id,
7374
}))}
7475
curPath={siteSpace.path}
7576
/>

packages/gitbook/src/components/Header/SpacesDropdownMenuItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ interface VariantSpace {
1010
id: Space['id'];
1111
title: Space['title'];
1212
url: string;
13+
isActive: boolean;
1314
}
1415

1516
// When switching to a different variant space, we reconstruct the URL by swapping the space path.
@@ -64,7 +65,7 @@ export function SpacesDropdownMenuItems(props: {
6465
<SpacesDropdownMenuItem
6566
key={space.id}
6667
variantSpace={space}
67-
active={false}
68+
active={space.isActive}
6869
currentSpacePath={curPath}
6970
/>
7071
))}

0 commit comments

Comments
 (0)