Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Jul 20, 2024
1 parent c9d8e67 commit 66c41d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/components/elements/MultiCodeEditor/MultiCodeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ const MultiCodeEditor = ({
document.dispatchEvent(event)
}

const updateLanguageIndex = event => setLanguageIndex(event.detail)

useEffect(() => {
const updateLanguageIndex = event => setLanguageIndex(event.detail)
document.addEventListener(LOCALSTORAGE_KEY, updateLanguageIndex)
return () =>
document.removeEventListener(LOCALSTORAGE_KEY, updateLanguageIndex)
}, [])
}, [setLanguageIndex])

return (
<CodeEditor
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const LiveDemo = React.memo(function LiveDemo ({
if (card) {
setMinHeight(card.getBoundingClientRect().height - 36 * 2 - 8 * 2)
}
})
}, [])

const [inputUrl, setInputUrl] = useState(query.url || '')

Expand Down
15 changes: 10 additions & 5 deletions src/templates/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import React from 'react'
import PageTemplate from './page'
import DocTemplate from './doc'

export const Head = ({ pageContext, location, data }) => {
if (!pageContext.isDocPage) {
return <Meta {...data.markdownRemark.frontmatter} />
}

const HeadDoc = ({ data, location, pageContext }) => {
const { name } = useSiteMetadata()
const activeRouteName = getActiveRouteName(location)

Expand All @@ -26,6 +22,15 @@ export const Head = ({ pageContext, location, data }) => {
)
}

export const Head = ({ pageContext, location, data }) =>
pageContext.isDocPage
? (
HeadDoc({ location, pageContext, data })
)
: (
<Meta {...data.markdownRemark.frontmatter} />
)

const Template = ({ pageContext, data, ...props }) => {
const { isDocPage, isBlogPage, lastEdited, githubUrl } = pageContext
const { frontmatter, rawMarkdownBody } = data.markdownRemark
Expand Down

0 comments on commit 66c41d1

Please sign in to comment.