1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-09-11 06:35:24 +03:00

Remove title resolver from gatsby theme

This commit is contained in:
Brent Jackson 2020-01-29 16:02:22 -05:00
parent bc890e6fcd
commit 961fd03e53
5 changed files with 11 additions and 20 deletions

View File

@ -4,3 +4,12 @@
---
## Boop bop
---
Does HMR break with this change?
---
Adding another slide...

View File

@ -1,6 +0,0 @@
This deck does not have any headings
---
Which means the resolver won't get a title

View File

@ -43,12 +43,6 @@ const mdxResolverPassthrough = fieldName => async (
return result
}
const resolveTitle = async (...args) => {
const headings = await mdxResolverPassthrough('headings')(...args)
const [first = {}] = headings
return first.value || ''
}
exports.sourceNodes = ({ actions, schema }) => {
const { createTypes } = actions
createTypes(
@ -59,10 +53,6 @@ exports.sourceNodes = ({ actions, schema }) => {
slug: {
type: `String!`,
},
title: {
type: `String!`,
resolve: resolveTitle,
},
body: {
type: `String!`,
resolve: mdxResolverPassthrough(`body`),
@ -83,7 +73,6 @@ exports.createPages = async ({ graphql, actions, reporter, pathPrefix }) => {
node {
id
slug
title
}
}
}

View File

@ -71,7 +71,7 @@ const DefaultMode = ({ children }) => <React.Fragment children={children} />
export default ({
slides = [],
pageContext: { title, slug },
pageContext: { slug },
theme = {},
themes = [],
...props
@ -112,7 +112,6 @@ export default ({
return (
<>
<Helmet>
<title>{title}</title>
{head}
</Helmet>
<GoogleFont theme={mergedTheme} />

View File

@ -31,7 +31,7 @@ export default ({ decks }) => {
textDecoration: 'underline',
},
}}>
{d.title || d.slug}
{d.slug}
</Link>
</li>
))}