Update SpacesDropdown to manage active state based on current space (#3356)

Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
This commit is contained in:
conico974
2025-06-19 13:39:59 +02:00
committed by GitHub
parent 8d3c6562a2
commit 2dfd5aab20
3 changed files with 8 additions and 6 deletions
+5 -5
View File
@@ -117,11 +117,11 @@ const testCases: TestsCase[] = [
contentBaseURL: 'https://docs.gradient.network',
tests: [{ name: 'Home', url: '/' }],
},
{
name: 'mygate-network.gitbook.io',
contentBaseURL: 'https://mygate-network.gitbook.io',
tests: [{ name: 'Home', url: '/' }],
},
// {
// name: 'mygate-network.gitbook.io',
// contentBaseURL: 'https://mygate-network.gitbook.io',
// tests: [{ name: 'Home', url: '/' }],
// },
{
name: 'treasurenft.gitbook.io',
contentBaseURL: 'https://treasurenft.gitbook.io',
@@ -70,6 +70,7 @@ export function SpacesDropdown(props: {
id: space.id,
title: space.title,
url: getSiteSpaceURL(context, space),
isActive: space.id === siteSpace.id,
}))}
curPath={siteSpace.path}
/>
@@ -10,6 +10,7 @@ interface VariantSpace {
id: Space['id'];
title: Space['title'];
url: string;
isActive: boolean;
}
// When switching to a different variant space, we reconstruct the URL by swapping the space path.
@@ -64,7 +65,7 @@ export function SpacesDropdownMenuItems(props: {
<SpacesDropdownMenuItem
key={space.id}
variantSpace={space}
active={false}
active={space.isActive}
currentSpacePath={curPath}
/>
))}