1- import React , { useState } from "react" ;
2- import { HiOutlineChevronLeft } from "@react-icons/all-files/hi/HiOutlineChevronLeft" ;
3- import { Link } from "gatsby" ;
4- import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward" ;
5- import { componentsData } from "../../sections/Projects/Sistent/components/content" ;
1+ import React , { useState } from "react" ;
2+ import { HiOutlineChevronLeft } from "@react-icons/all-files/hi/HiOutlineChevronLeft" ;
3+ import { Link } from "gatsby" ;
4+ import { IoIosArrowForward } from "@react-icons/all-files/io/IoIosArrowForward" ;
5+ import { componentsData } from "../../sections/Projects/Sistent/components/content" ;
66
77import TOCWrapper from "./toc.style" ;
8- import { IoIosArrowDown } from "@react-icons/all-files/io/IoIosArrowDown" ;
8+ import { IoIosArrowDown } from "@react-icons/all-files/io/IoIosArrowDown" ;
99
10- import { useLocation } from "@reach/router" ;
10+ import { useLocation } from "@reach/router" ;
1111
1212const TOC = ( ) => {
1313 const [ expand , setExpand ] = useState ( false ) ;
1414 const location = useLocation ( ) ;
15- const [ expandIdenity , setExpandIdentity ] = useState (
15+ const [ expandIdentity , setExpandIdentity ] = useState (
1616 location . pathname . includes ( "/identity" )
1717 ) ;
1818 const [ expandComponent , setExpandComponent ] = useState (
@@ -28,7 +28,7 @@ const TOC = () => {
2828 < TOCWrapper >
2929 < div className = "go-back" >
3030 < Link to = "/projects/sistent" >
31- < HiOutlineChevronLeft />
31+ < HiOutlineChevronLeft />
3232 < h4 > Table of Contents</ h4 >
3333 </ Link >
3434 < div className = "toc-toggle-btn" >
@@ -62,18 +62,19 @@ const TOC = () => {
6262 </ li >
6363 < li >
6464 < div >
65- < li
65+ < div
66+ type = "button"
6667 className = "toc-sub-heading identity"
6768 onClick = { ( ) => setExpandIdentity ( ( prev ) => ! prev ) }
6869 >
6970 Identity
70- { expandIdenity ?
71- < IoIosArrowDown style = { { zIndex : 2 } } /> :
72- < IoIosArrowForward style = { { zIndex : 2 } } />
71+ { expandIdentity ?
72+ < IoIosArrowDown style = { { zIndex : 2 } } /> :
73+ < IoIosArrowForward style = { { zIndex : 2 } } />
7374 }
74- </ li >
75- { expandIdenity && (
76- < div className = "identity-sublinks" >
75+ </ div >
76+ { expandIdentity && (
77+ < ul className = "identity-sublinks" >
7778 < li >
7879 < Link
7980 to = "/projects/sistent/identity/color"
@@ -119,42 +120,40 @@ const TOC = () => {
119120 Typography
120121 </ Link >
121122 </ li >
122- </ div >
123+ </ ul >
123124 ) }
124125 </ div >
125126 </ li >
126127 < li >
127128 < div >
128- < li
129+ < div
129130 className = "toc-sub-heading components"
130131 onClick = { ( ) => setExpandComponent ( ( prev ) => ! prev ) }
131132 >
132133 Components
133134 { expandComponent ?
134- < IoIosArrowDown style = { { zIndex : 2 } } /> :
135- < IoIosArrowForward style = { { zIndex : 2 } } />
135+ < IoIosArrowDown style = { { zIndex : 2 } } /> :
136+ < IoIosArrowForward style = { { zIndex : 2 } } />
136137 }
137- </ li >
138+ </ div >
138139 { expandComponent && (
139- < div className = "components-sublinks" >
140- < li >
141- { sortedComponentArray . map ( ( component ) => (
142- < li key = { component . id } >
143- < Link
144- to = { component . url }
145- className = { `toc-sub-heading toc-sub-inline components-item ${
146- location . pathname . split ( "/" ) [ 4 ] === component . url . split ( "/" ) [ 4 ]
147- ? "active"
148- : ""
149- } `}
150- activeClassName = "active"
151- >
152- { component . name }
153- </ Link >
154- </ li >
155- ) ) }
156- </ li >
157- </ div >
140+ < ul className = "components-sublinks" >
141+ { sortedComponentArray . map ( ( component ) => (
142+ < li key = { component . id } >
143+ < Link
144+ to = { component . url }
145+ className = { `toc-sub-heading toc-sub-inline components-item ${
146+ location . pathname . split ( "/" ) [ 4 ] === component . url . split ( "/" ) [ 4 ]
147+ ? "active"
148+ : ""
149+ } `}
150+ activeClassName = "active"
151+ >
152+ { component . name }
153+ </ Link >
154+ </ li >
155+ ) ) }
156+ </ ul >
158157 ) }
159158 </ div >
160159 </ li >
0 commit comments