mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 07:35:16 +00:00
Update SpacesDropdown to manage active state based on current space (#3356)
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user