-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Nested Templates (and wrapping JavaScript with templates) #1895
Closed
Closed
Changes from 30 commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
561acaa
layout example structure for templates that javascript can use
jbolda 559dc23
uncomment chunks from js template
jbolda 296076d
rename markdown post class
jbolda d064183
simplify js blog post that we can get to console.log
jbolda 03b1f9c
add query to js template
jbolda bf008a0
start working on nested templates
jbolda 8e46c57
forgot to delete console.log
jbolda b3b0b52
update reducers to handle arrays
jbolda 6b2ef46
change component in gatsby-node example to array
jbolda c59ee2f
comment on expectations in javascript template
jbolda 39e7d32
loader will set pageComponent via syncRequires
jbolda f30f3f0
mututate createPages component into array always, easier to consider
jbolda 45542c5
update page runners and writers to expect component as array
jbolda f73cc32
layouts are strings, and run through page-query-runner
jbolda 1a66164
seems the component is undefined sometimes as well?
jbolda 1169ead
Merge remote-tracking branch 'upstream/master' into templates-wrappin…
jbolda 0d9fed7
update layout graphql for new siteMetadata format
jbolda fbb0303
forgot to update prop reference
jbolda 08777c9
loader accepts component as array
jbolda eee56ff
nest the templates, data is missing though
jbolda 69d612a
forgot a console.log
jbolda c298105
flatten component requires array
jbolda e326234
normalize paths otherwise match on path doesn't work
jbolda 896db95
clean up console.log
jbolda e049687
update jsBlogPostTemplate to accept graphql based on page
jbolda 5897557
add componentChunkName as an object key on josn data
jbolda c0dbec7
fix json file writing to add to existing json, was overwritting
jbolda 90f63f1
add component property to look up proper json data using componentChu…
jbolda 5c9d351
update example to use js template for blog posts, use new layouts as …
jbolda 8457435
clarify where layouts come from
jbolda 36a280d
add scripts to help in core dev
jbolda 5edd70c
merge in upstream
jbolda 6ed2242
delete files that didn't delete in the upstream merge?
jbolda b6798b0
sometimes dates on frontmatter are undefined which throws errors on J…
jbolda c2c3888
update production files, build completes, error on loader during serve
jbolda 7d9aee7
delete console.log before I forget
jbolda 3f84451
missed a few more console.log
jbolda a54f987
fixing various loader errors, still errors on js hyerate on page
jbolda a74bb78
simplify article variables
jbolda 6fe38ee
now componentChunkName can be set in prod-app
jbolda 478adb6
loader.fetchResource doesn't expect an array
jbolda ec15bdd
update test snapshots --build-all
jbolda cdf8d54
merge from upstream --build-all
jbolda ea011fd
update snapshot with normalized path
jbolda a6a505a
idk why this changed the first time...
jbolda dac2eec
Merge remote-tracking branch 'upstream/master' into templates-wrappin…
jbolda 77ef756
update docjs snapshot --build-all
jbolda 3f22be3
Merge remote-tracking branch 'upstream/master' into templates-wrappin…
jbolda 3909cae
merge from upstream
jbolda b1113cd
template restructure (psuedo code because all the installs broke)
jbolda d17f355
finish off using-js template pseudo code
jbolda 0c4be6d
/contact wasn't being created
jbolda 7cb3388
fix dev 404
jbolda 1862bea
merge from upstream
jbolda 986a0ce
rename variable in nested, based on merge
jbolda e9a264d
Merge remote-tracking branch 'upstream/master' into templates-wrappin…
jbolda 9596e2b
update transformer-docjs snapshot
jbolda 6c1e622
test fails locally, but passes on server
jbolda 2cefaeb
add redux page multi-component test --build-all
jbolda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ class choroplethAltBase extends React.Component { | |
} | ||
|
||
render() { | ||
console.log(this) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why |
||
let data = this.props.data.markdownRemark | ||
let html = data.html | ||
let frontmatter = this.props.data.jsFrontmatter.data | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
examples/using-javascript-transforms/src/layouts/blogPost.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from "react" | ||
import Link from "gatsby-link" | ||
import Helmet from "react-helmet" | ||
import moment from "moment" | ||
|
||
import MasterLayout from "./master" | ||
|
||
class BlogPostTemplate extends React.Component { | ||
render() { | ||
let siteMetadata = this.props.data.site.siteMetadata | ||
|
||
const home = ( | ||
<div className="nav"> | ||
<div className="container"> | ||
<div className="nav-left"> | ||
<Link className="nav-item is-tab is-active" to={`/`}> | ||
Home | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
|
||
let published = <div className="date-published" /> | ||
|
||
return ( | ||
<div> | ||
<MasterLayout {...this.props}> | ||
{home} | ||
<div className="container"> | ||
{this.props.children()} | ||
</div> | ||
</MasterLayout> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default BlogPostTemplate | ||
|
||
export const pageQuery = graphql` | ||
query BlogPostLayoutBySlug { | ||
site { | ||
siteMetadata { | ||
title | ||
siteDescr | ||
siteAuthor | ||
siteEmailUrl | ||
siteEmailPretty | ||
siteTwitterUrl | ||
siteTwitterPretty | ||
} | ||
} | ||
} | ||
` |
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
examples/using-javascript-transforms/src/layouts/inset-page.js
This file was deleted.
Oops, something went wrong.
49 changes: 49 additions & 0 deletions
49
examples/using-javascript-transforms/src/layouts/insetPage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from "react" | ||
import SiteSidebar from "../components/SiteSidebar" | ||
|
||
import MasterLayout from "./master" | ||
// It would be nice to have props with data that we | ||
// that we could push down into the sidebar. We can't | ||
// so we just cheat and pull it out of a yaml for the | ||
// time being. | ||
|
||
class InsetPageTemplate extends React.Component { | ||
render() { | ||
const siteMetadata = this.props.data.site | ||
|
||
return ( | ||
<div className="PageTemplate"> | ||
<MasterLayout {...this.props}> | ||
<div className="section"> | ||
<div className="columns"> | ||
<div className="column is-one-quarter"> | ||
<SiteSidebar {...this.props} /> | ||
</div> | ||
<div className="column"> | ||
{this.props.children()} | ||
</div> | ||
</div> | ||
</div> | ||
</MasterLayout> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default InsetPageTemplate | ||
|
||
export const pageQuery = graphql` | ||
query InsetLayoutBySlug { | ||
site { | ||
siteMetadata { | ||
title | ||
siteDescr | ||
siteAuthor | ||
siteEmailUrl | ||
siteEmailPretty | ||
siteTwitterUrl | ||
siteTwitterPretty | ||
} | ||
} | ||
} | ||
` |
26 changes: 26 additions & 0 deletions
26
examples/using-javascript-transforms/src/layouts/master.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from "react" | ||
import * as PropTypes from "prop-types" | ||
import Helmet from "react-helmet" | ||
import "../static/css/base.scss" | ||
|
||
class MasterLayout extends React.Component { | ||
render() { | ||
let siteMetadata = this.props.data.site.siteMetadata | ||
let location = this.props.location.pathname | ||
|
||
return ( | ||
<div className="MasterLayout"> | ||
<Helmet | ||
defaultTitle={siteMetadata.title} | ||
meta={[ | ||
{ name: `description`, content: siteMetadata.siteDescr }, | ||
{ name: `keywords`, content: `articles` }, | ||
]} | ||
/> | ||
{this.props.children} | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default MasterLayout |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
console.log
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using them to test, and forgot to delete them.