Skip to content

Commit 1346905

Browse files
shantanu2107Shantanu Chauhan
andauthored
Feature/bug#1355 (#1366)
* Added proper links for jsonschema-core.md and jsonschema-validation.md in specification-links.md * the specification dropdown fix * changes * changes * changes --------- Co-authored-by: Shantanu Chauhan <[email protected]>
1 parent b7028cc commit 1346905

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

components/Sidebar.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,31 +269,59 @@ export const DocsNav = ({
269269
});
270270
useEffect(() => {
271271
const pathWtihoutFragment = extractPathWithoutFragment(router.asPath);
272+
const newActive = {
273+
getDocs: false,
274+
getStarted: false,
275+
getReference: false,
276+
getSpecification: false,
277+
};
272278
if (getDocsPath.includes(pathWtihoutFragment)) {
273-
setActive({ ...active, getDocs: true });
279+
newActive.getDocs = true;
274280
} else if (getStartedPath.includes(pathWtihoutFragment)) {
275-
setActive({ ...active, getStarted: true });
281+
newActive.getStarted = true;
276282
} else if (getReferencePath.includes(pathWtihoutFragment)) {
277-
setActive({ ...active, getReference: true });
283+
newActive.getReference = true;
278284
} else if (getSpecificationPath.includes(pathWtihoutFragment)) {
279-
setActive({ ...active, getSpecification: true });
285+
newActive.getSpecification = true;
280286
}
287+
288+
setActive(newActive);
281289
}, [router.asPath]);
282290

283291
const handleClickDoc = () => {
284-
setActive({ ...active, getDocs: !active.getDocs });
292+
setActive({
293+
getDocs: !active.getDocs,
294+
getStarted: false,
295+
getReference: false,
296+
getSpecification: false,
297+
});
285298
};
286299

287300
const handleClickGet = () => {
288-
setActive({ ...active, getStarted: !active.getStarted });
301+
setActive({
302+
getDocs: false,
303+
getStarted: !active.getStarted,
304+
getReference: false,
305+
getSpecification: false,
306+
});
289307
};
290308

291309
const handleClickReference = () => {
292-
setActive({ ...active, getReference: !active.getReference });
310+
setActive({
311+
getDocs: false,
312+
getStarted: false,
313+
getReference: !active.getReference,
314+
getSpecification: false,
315+
});
293316
};
294317

295318
const handleClickSpec = () => {
296-
setActive({ ...active, getSpecification: !active.getSpecification });
319+
setActive({
320+
getDocs: false,
321+
getStarted: false,
322+
getReference: false,
323+
getSpecification: !active.getSpecification,
324+
});
297325
};
298326

299327
const rotate = active.getDocs ? 'rotate(180deg)' : 'rotate(0)';

0 commit comments

Comments
 (0)