-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove react-helmet from src/html.js as that's handled by gatsby-plugin-react-helmet * Run format
- Loading branch information
1 parent
bfb4f8d
commit 5a37ebd
Showing
25 changed files
with
1,024 additions
and
786 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import React from 'react'; | ||
import { Page, Row } from './styled'; | ||
import React from "react" | ||
import { Page, Row } from "./styled" | ||
|
||
const Footer = props => | ||
<footer> | ||
<Page> | ||
<Row height={5}> | ||
This is a sample footer. | ||
</Row> | ||
<Row height={5}>This is a sample footer.</Row> | ||
</Page> | ||
</footer> | ||
|
||
export default Footer; | ||
export default Footer |
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 |
---|---|---|
@@ -1,39 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Link from 'gatsby-link'; | ||
import { H1, H2, H3, H4 } from '../components/styled'; | ||
import { Row, Page, Column } from './styled'; | ||
|
||
const Header = ({ title, subtitle, pages }) => { | ||
import React from "react" | ||
import PropTypes from "prop-types" | ||
import Link from "gatsby-link" | ||
import { H1, H2, H3, H4 } from "../components/styled" | ||
import { Row, Page, Column } from "./styled" | ||
|
||
const Header = ({ title, subtitle, pages }) => | ||
// TODO : Sort order of menu based on field menu_order | ||
return ( | ||
( | ||
<Page> | ||
<Row> | ||
<H3>{title}</H3> | ||
<H3> | ||
{title} | ||
</H3> | ||
</Row> | ||
<Row> | ||
<H4>{subtitle}</H4> | ||
<H4> | ||
{subtitle} | ||
</H4> | ||
</Row> | ||
<Row> | ||
<Column fluid xs={1} sm={10} md={10} lg={10}> | ||
<span><Link to={'/'}>Home</Link> - </span> | ||
<span> | ||
<Link to={`/`}>Home</Link> -{` `} | ||
</span> | ||
{pages.edges.map((p, i) => { | ||
if (p.node.slug == 'blog') return | ||
if (p.node.slug == 'home') return | ||
return <span key={p.node.id}>{i !== 0 ? ' - ' : ''}<Link to={p.node.slug}>{unescape(p.node.title)}</Link></span> | ||
if (p.node.slug == `blog`) return | ||
if (p.node.slug == `home`) return | ||
return ( | ||
<span key={p.node.id}> | ||
{i !== 0 ? ` - ` : ``} | ||
<Link to={p.node.slug}> | ||
{unescape(p.node.title)} | ||
</Link> | ||
</span> | ||
) | ||
})} | ||
</Column> | ||
<hr /> | ||
</Row> | ||
</Page> | ||
) | ||
} | ||
|
||
Header.propTypes = { | ||
title: PropTypes.string, | ||
pages: PropTypes.object.isRequired, | ||
} | ||
|
||
|
||
export default Header; | ||
export default Header |
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
59 changes: 27 additions & 32 deletions
59
examples/using-wordpress/src/components/PostsListSearchable.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 |
---|---|---|
@@ -1,68 +1,63 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { H3, Row, Page, Column } from './styled'; | ||
import PostPreview from './PostPreview' | ||
import React, { Component } from "react" | ||
import PropTypes from "prop-types" | ||
import { H3, Row, Page, Column } from "./styled" | ||
import PostPreview from "./PostPreview" | ||
|
||
class PostsListSearchable extends Component { | ||
|
||
// Put the props in the state | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
data: this.props.propsData.allWordpressPost.edges | ||
data: this.props.propsData.allWordpressPost.edges, | ||
} | ||
} | ||
|
||
handleFilter = id => { | ||
this.setState({ | ||
data: this.props.propsData.allWordpressPost.edges.filter(p => { | ||
return p.node.categories.includes(id.replace('CATEGORY_', '')) | ||
}) | ||
data: this.props.propsData.allWordpressPost.edges.filter(p => p.node.categories.includes(id.replace(`CATEGORY_`, ``))), | ||
}) | ||
} | ||
|
||
resetFilter = () => this.setState({ data: this.props.propsData.allWordpressPost.edges }) | ||
resetFilter = () => | ||
this.setState({ data: this.props.propsData.allWordpressPost.edges }) | ||
|
||
render() { | ||
|
||
return ( | ||
<Page> | ||
<H3>The latests blog posts</H3> | ||
<Row gutter gutterWhite> | ||
<Column fluid xs={1} sm={10} md={10} lg={10}> | ||
<span>Filter by category: </span> | ||
<span>Filter by category: </span> | ||
<span onClick={() => this.resetFilter()}>All - </span> | ||
{ | ||
this.props.propsData.allWordpressCategory.edges.map((cat, i) => { | ||
|
||
return (<span | ||
key={cat.node.id} | ||
onClick={() => this.handleFilter(cat.node.id)} | ||
> | ||
{i !== 0 ? ' - ':''}{cat.node.name} | ||
</span>) | ||
}) | ||
} | ||
{this.props.propsData.allWordpressCategory.edges.map((cat, i) => ( | ||
<span | ||
key={cat.node.id} | ||
onClick={() => this.handleFilter(cat.node.id)} | ||
> | ||
{i !== 0 ? ` - ` : ``} | ||
{cat.node.name} | ||
</span> | ||
))} | ||
<span onClick={() => this.resetFilter()}> - Reset filter</span> | ||
</Column> | ||
</Row> | ||
<Row gutter> | ||
{ | ||
this.state.data.map(article => | ||
<PostPreview key={article.node.slug} id={article.node.slug} article={article} />)} | ||
</Row> | ||
<Row gutter height={19}> | ||
{this.state.data.map(article => | ||
<PostPreview | ||
key={article.node.slug} | ||
id={article.node.slug} | ||
article={article} | ||
/> | ||
)} | ||
</Row> | ||
<Row gutter height={19} /> | ||
</Page> | ||
) | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
PostsListSearchable.propTypes = { | ||
propsData: PropTypes.object.isRequired, | ||
} | ||
|
||
export default PostsListSearchable; | ||
export default PostsListSearchable |
Oops, something went wrong.