Skip to content

Commit

Permalink
ART-5: add check for component presence in article list
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernatskyi Artem committed Nov 21, 2024
1 parent 12d04eb commit 535a0e1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/MobileTOC/MobileTOC.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import {useState} from "react";
import {motion} from "framer-motion";
import {useLocation} from "@docusaurus/router";
import "./MobileTOC.css";

export default function MobileTOC({sections}) {
export default function MobileTOC({sections, children}) {

const [isOpen, setIsOpen] = useState(false);

Expand All @@ -16,10 +17,10 @@ export default function MobileTOC({sections}) {
return `#${ref}`;
}

return (
return location.pathname !== "/iasa-sc-blog/blog" && !location.pathname.startsWith("/iasa-sc-blog/blog/tags") && location.pathname.startsWith("/iasa-sc-blog/blog") ? (
<div className="mobile-nav">
<button className={`mobile-nav-toggle ${isOpen ? "active" : ""}`} onClick={handleChangeIsOpen}> На цій
сторінці
<button className={`mobile-nav-toggle ${isOpen ? "active" : ""}`} onClick={handleChangeIsOpen}> {children === undefined ?
"На цій сторінці" : children}
</button>
<motion.div
className='mobile-nav-content'
Expand Down Expand Up @@ -49,5 +50,5 @@ export default function MobileTOC({sections}) {
</ul>
</motion.div>
</div>
)
) : null;
}

0 comments on commit 535a0e1

Please sign in to comment.