Skip to content

Commit b820cf0

Browse files
Updated Handbook TOC for improved mobile compatibility
Signed-off-by: Rajesh-Nagarajan-11 <rajeshnagarajan36@gmail.com>
1 parent ab65391 commit b820cf0

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

src/sections/Community/Handbook/handbook-single/HandbookTOC.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
1-
import React from "react";
1+
import React, { useState } from "react";
22
import { Link } from "gatsby";
33
import TOCWrapper from "../../../../components/handbook-navigation/toc.style";
44
import { HiOutlineChevronLeft } from "@react-icons/all-files/hi/HiOutlineChevronLeft";
5+
import { IoMdClose } from "@react-icons/all-files/io/IoMdClose";
6+
import { IoIosArrowDropdownCircle } from "@react-icons/all-files/io/IoIosArrowDropdownCircle";
57

68
const HandbookTOC = ({ pages, currentSlug }) => {
9+
const [expand, setExpand] = useState(false);
10+
711
return (
812
<TOCWrapper>
913
<div className="go-back">
1014
<Link to="/community/handbook">
1115
<HiOutlineChevronLeft />
1216
<h4>Table of Contents</h4>
1317
</Link>
18+
<div className="toc-toggle-btn">
19+
{expand ? (
20+
<IoMdClose
21+
className="toc-menu-icon"
22+
onClick={function () {
23+
setExpand(!expand);
24+
}}
25+
/>
26+
) : (
27+
<IoIosArrowDropdownCircle
28+
className="toc-menu-icon"
29+
onClick={function () {
30+
setExpand(!expand);
31+
}}
32+
/>
33+
)}
34+
</div>
1435
</div>
1536
<div className="toc-list">
16-
<ul className="toc-ul">
37+
<ul className={`toc-ul ${expand ? "toc-ul-open" : ""}`}>
1738
{pages.map((page, index) => (
1839
<li key={index}>
1940
<Link

0 commit comments

Comments
 (0)