diff --git a/src/templates/MarkdownList.jsx b/src/templates/MarkdownList.jsx index 590a63e4..7a040f1e 100644 --- a/src/templates/MarkdownList.jsx +++ b/src/templates/MarkdownList.jsx @@ -6,17 +6,17 @@ import styles from '../templates/Doc.module.scss' import MarkdownTemplate from './MarkdownTemplate' export default function MarkdownList({ pageContext }) { - const sub_sections = {} + const subSections = {} pageContext.markdownList.map(({ node }) => { - if (!sub_sections[node.frontmatter.sub_section]) { - sub_sections[node.frontmatter.sub_section] = [] + if (!subSections[node.frontmatter.sub_section]) { + subSections[node.frontmatter.sub_section] = [] } - sub_sections[node.frontmatter.sub_section].push(node) + subSections[node.frontmatter.sub_section].push(node) }) const [selectedSubSection, setSelectedSubSection] = useState(0) const [elem, setElem] = useState( - sub_sections[Object.keys(sub_sections)[selectedSubSection]][0] + subSections[Object.keys(subSections)[selectedSubSection]][0] ) const changePage = (subSectionIndex, node) => { @@ -26,7 +26,7 @@ export default function MarkdownList({ pageContext }) { const changeSubsection = (index) => { setSelectedSubSection(index) - setElem(sub_sections[Object.keys(sub_sections)[index]][0]) + setElem(subSections[Object.keys(subSections)[index]][0]) } return ( @@ -36,28 +36,40 @@ export default function MarkdownList({ pageContext }) {