added localization to table of contents
This commit is contained in:
parent
fa2a389686
commit
8c8e363915
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useState } from "react"
|
||||
import { useContext, useEffect, useState } from "react"
|
||||
import { Collapse } from "react-collapse"
|
||||
import storage from "local-storage-fallback"
|
||||
|
||||
|
@ -7,6 +7,7 @@ import { faCaretDown, faCaretUp } from "@fortawesome/free-solid-svg-icons"
|
|||
import styled from "styled-components"
|
||||
|
||||
import theming from "../../styles/theming"
|
||||
import { globalContext } from "../../globalContext"
|
||||
|
||||
const StyledTocToggleButton = styled.button`
|
||||
cursor: pointer;
|
||||
|
@ -29,6 +30,7 @@ const StyledCollapseContainer = styled.div`
|
|||
`
|
||||
|
||||
const Toc = (props: { data?: string }) => {
|
||||
const { globalState } = useContext(globalContext)
|
||||
const [isTocOpened, setIsTocOpened] = useState(
|
||||
storage.getItem("isTocOpened") == "true"
|
||||
)
|
||||
|
@ -47,7 +49,7 @@ const Toc = (props: { data?: string }) => {
|
|||
}}
|
||||
>
|
||||
<strong>
|
||||
Table of Contents{" "}
|
||||
{globalState.locale == "en" ? "Table of Contents " : "목차 "}
|
||||
<FontAwesomeIcon icon={isTocOpened ? faCaretUp : faCaretDown} />
|
||||
</strong>
|
||||
</StyledTocToggleButton>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue