website/src/templates/note.tsx

31 lines
571 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 }) => {
const { frontmatter, body } = data.mdx;
2020-11-27 16:08:32 +00:00
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 00:39:21 +00:00
query NotesIndexQuery($id: String!) {
mdx(id: { eq: $id }) {
frontmatter {
title
}
tableOfContents
body
2020-11-27 16:08:32 +00:00
}
}
2020-11-28 00:39:21 +00:00
`;