2020-02-18 22:59:12 +00:00
|
|
|
import React, { useEffect } from 'react'
|
|
|
|
import { graphql } from 'gatsby'
|
|
|
|
import Layout from '../components/layout'
|
|
|
|
import { MDXRenderer } from 'gatsby-plugin-mdx'
|
|
|
|
import { MDXProvider } from '@mdx-js/react'
|
2019-12-12 21:27:56 +00:00
|
|
|
|
2019-12-14 16:10:54 +00:00
|
|
|
const ide =
|
2020-02-18 22:59:12 +00:00
|
|
|
'https://repos.ctdo.de/-/ide/project/neri/ctdo-homepage/edit/master/-/src/pages/'
|
2019-12-14 16:10:54 +00:00
|
|
|
|
2019-12-17 21:54:47 +00:00
|
|
|
const MdLeakH1 = props => <h2 {...props}># {props.children}</h2>
|
2020-01-14 19:06:31 +00:00
|
|
|
const MdLeakH2 = props => <h3 {...props}>## {props.children}</h3>
|
|
|
|
const MdLeakH3 = props => <h4 {...props}>### {props.children}</h4>
|
|
|
|
const MdLeakH4 = props => <h5 {...props}>#### {props.children}</h5>
|
2019-12-17 21:54:47 +00:00
|
|
|
|
|
|
|
const components = {
|
|
|
|
h1: MdLeakH1,
|
|
|
|
h2: MdLeakH2,
|
|
|
|
h3: MdLeakH3,
|
|
|
|
h4: MdLeakH4,
|
|
|
|
}
|
|
|
|
|
2019-12-12 21:27:56 +00:00
|
|
|
export default function Template({
|
|
|
|
data, // this prop will be injected by the GraphQL query below.
|
|
|
|
}) {
|
2020-01-23 20:28:26 +00:00
|
|
|
const {
|
|
|
|
frontmatter: { title, edit, path },
|
|
|
|
body,
|
|
|
|
} = data.mdx
|
2019-12-12 21:27:56 +00:00
|
|
|
|
|
|
|
useEffect(() => {
|
2020-01-23 20:28:26 +00:00
|
|
|
document.title = `ctdo - ${title.toLowerCase()}`
|
|
|
|
}, [title])
|
2019-12-12 21:27:56 +00:00
|
|
|
|
2020-01-23 20:28:26 +00:00
|
|
|
const editLink = edit ? ide + edit : null
|
2019-12-14 16:10:54 +00:00
|
|
|
|
2019-12-12 21:27:56 +00:00
|
|
|
return (
|
2020-01-23 20:28:26 +00:00
|
|
|
<Layout path={path} editLink={editLink}>
|
2019-12-17 21:54:47 +00:00
|
|
|
<MDXProvider components={components}>
|
|
|
|
<MDXRenderer>{body}</MDXRenderer>
|
|
|
|
</MDXProvider>
|
2019-12-12 21:27:56 +00:00
|
|
|
</Layout>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export const pageQuery = graphql`
|
|
|
|
query($path: String!) {
|
2019-12-12 23:03:04 +00:00
|
|
|
mdx(frontmatter: { path: { eq: $path } }) {
|
|
|
|
body
|
2019-12-12 21:27:56 +00:00
|
|
|
frontmatter {
|
|
|
|
title
|
2020-01-22 12:33:25 +00:00
|
|
|
edit
|
2020-01-23 20:28:26 +00:00
|
|
|
path
|
2019-12-12 21:27:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|