File tree Expand file tree Collapse file tree
src/sections/Community/Handbook/handbook-single Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React from "react" ;
1+ import React , { useState } from "react" ;
22import { Link } from "gatsby" ;
33import TOCWrapper from "../../../../components/handbook-navigation/toc.style" ;
44import { 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
68const 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
You can’t perform that action at this time.
0 commit comments