website/src/templates/note.tsx

30 lines
586 B
TypeScript
Raw Normal View History

2020-11-28 00:39:21 +00:00
import React from 'react';
2020-11-27 16:08:32 +00:00
import Navbar from '../components/navbar';
2020-11-28 00:39:21 +00:00
import { graphql } from 'gatsby';
2020-11-27 16:08:32 +00:00
import { MDXRenderer } from 'gatsby-plugin-mdx';
2020-11-27 21:12:09 +00:00
export default ({ data }) => {
2020-11-28 20:50:20 +00:00
const { frontmatter, tableOfContents, body } = data.mdx;
2020-11-28 00:39:21 +00:00
return (
<>
<Navbar />
<main>
<h1>{frontmatter.title}</h1>
<MDXRenderer>{body}</MDXRenderer>
</main>
</>
);
2020-11-27 16:08:32 +00:00
};
export const query = graphql`
2020-11-28 03:35:36 +00:00
query NotesItemQuery($id: String!) {
2020-11-28 00:39:21 +00:00
mdx(id: { eq: $id }) {
frontmatter {
title
}
tableOfContents
body
2020-11-27 16:08:32 +00:00
}
}
2020-11-28 00:39:21 +00:00
`;