diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx
index b687a77af..d3192d7d8 100644
--- a/components/Sidebar.tsx
+++ b/components/Sidebar.tsx
@@ -190,7 +190,7 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
const [rotateChevron, setRotateChevron] = useState(false);
const handleRotate = () => setRotateChevron(!rotateChevron);
const rotate = rotateChevron ? 'rotate(180deg)' : 'rotate(0)';
- const pathWtihoutFragment = extractPathWithoutFragment(router.asPath);
+ const pathWithoutFragment = extractPathWithoutFragment(router.asPath);
useEffect(() => {
if (window) {
window.addEventListener('resize', () => {
@@ -213,19 +213,19 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
setOpen(!open);
}}
>
- {getDocsPath.includes(pathWtihoutFragment) && (
+ {getDocsPath.includes(pathWithoutFragment) && (
Introduction
)}
- {getStartedPath.includes(pathWtihoutFragment) && (
+ {getStartedPath.includes(pathWithoutFragment) && (
Get started
)}
- {getGuidesPath.includes(pathWtihoutFragment) && (
+ {getGuidesPath.includes(pathWithoutFragment) && (
Guides
)}
- {getReferencePath.includes(pathWtihoutFragment) && (
+ {getReferencePath.includes(pathWithoutFragment) && (
Reference
)}
- {getSpecificationPath.includes(pathWtihoutFragment) && (
+ {getSpecificationPath.includes(pathWithoutFragment) && (
Specification
)}
{router.pathname === null && (
@@ -280,6 +280,7 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
};
export const DocsNav = ({
+ open, // eslint-disable-line @typescript-eslint/no-unused-vars
setOpen,
}: {
open: boolean;
@@ -294,7 +295,7 @@ export const DocsNav = ({
getSpecification: false,
});
useEffect(() => {
- const pathWtihoutFragment = extractPathWithoutFragment(router.asPath);
+ const pathWithoutFragment = extractPathWithoutFragment(router.asPath);
const newActive = {
getDocs: false,
getStarted: false,
@@ -302,16 +303,15 @@ export const DocsNav = ({
getReference: false,
getSpecification: false,
};
- if (getDocsPath.includes(pathWtihoutFragment)) {
+ if (getDocsPath.includes(pathWithoutFragment)) {
newActive.getDocs = true;
- } else if (getStartedPath.includes(pathWtihoutFragment)) {
+ } else if (getStartedPath.includes(pathWithoutFragment)) {
newActive.getStarted = true;
- setActive({ ...active, getStarted: true });
- } else if (getReferencePath.includes(pathWtihoutFragment)) {
+ } else if (getReferencePath.includes(pathWithoutFragment)) {
newActive.getReference = true;
- } else if (getSpecificationPath.includes(pathWtihoutFragment)) {
+ } else if (getSpecificationPath.includes(pathWithoutFragment)) {
newActive.getSpecification = true;
- } else if (getGuidesPath.includes(pathWtihoutFragment)) {
+ } else if (getGuidesPath.includes(pathWithoutFragment)) {
newActive.getGuides = true;
}
setActive(newActive);
@@ -339,17 +339,30 @@ export const DocsNav = ({
}
}, [resolvedTheme]);
+ const handleAccordion = (section: keyof typeof active) => (open: boolean) => {
+ if (open) {
+ setActive({
+ getDocs: false,
+ getStarted: false,
+ getGuides: false,
+ getReference: false,
+ getSpecification: false,
+ [section]: true,
+ });
+ } else {
+ setActive((prev) => ({
+ ...prev,
+ [section]: false,
+ }));
+ }
+ };
+
return (