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 { Collapse } from "react-collapse"
|
||||||
import storage from "local-storage-fallback"
|
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 styled from "styled-components"
|
||||||
|
|
||||||
import theming from "../../styles/theming"
|
import theming from "../../styles/theming"
|
||||||
|
import { globalContext } from "../../globalContext"
|
||||||
|
|
||||||
const StyledTocToggleButton = styled.button`
|
const StyledTocToggleButton = styled.button`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -29,6 +30,7 @@ const StyledCollapseContainer = styled.div`
|
||||||
`
|
`
|
||||||
|
|
||||||
const Toc = (props: { data?: string }) => {
|
const Toc = (props: { data?: string }) => {
|
||||||
|
const { globalState } = useContext(globalContext)
|
||||||
const [isTocOpened, setIsTocOpened] = useState(
|
const [isTocOpened, setIsTocOpened] = useState(
|
||||||
storage.getItem("isTocOpened") == "true"
|
storage.getItem("isTocOpened") == "true"
|
||||||
)
|
)
|
||||||
|
@ -47,7 +49,7 @@ const Toc = (props: { data?: string }) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<strong>
|
<strong>
|
||||||
Table of Contents{" "}
|
{globalState.locale == "en" ? "Table of Contents " : "목차 "}
|
||||||
<FontAwesomeIcon icon={isTocOpened ? faCaretUp : faCaretDown} />
|
<FontAwesomeIcon icon={isTocOpened ? faCaretUp : faCaretDown} />
|
||||||
</strong>
|
</strong>
|
||||||
</StyledTocToggleButton>
|
</StyledTocToggleButton>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue