1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-01-03 18:35:00 +01:00

revert refactoring, gatsby doesn't like splitting up StaticQuery

This commit is contained in:
Matthias Kretschmann 2018-06-22 19:37:14 +02:00
parent 4e06ef5b83
commit 9ecd43d0e3
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 32 additions and 52 deletions

View File

@ -4,7 +4,13 @@ import { StaticQuery, graphql } from 'gatsby'
import { MoveIn } from '../atoms/Animations' import { MoveIn } from '../atoms/Animations'
import styles from './Availability.module.scss' import styles from './Availability.module.scss'
const AvailabilityElementQuery = ({ render }) => ( class Availability extends PureComponent {
constructor(props) {
super(props)
}
render() {
return (
<StaticQuery <StaticQuery
query={graphql` query={graphql`
query AvailabilityQuery { query AvailabilityQuery {
@ -17,18 +23,6 @@ const AvailabilityElementQuery = ({ render }) => (
} }
} }
`} `}
render={render}
/>
)
class Availability extends PureComponent {
constructor(props) {
super(props)
}
render() {
return (
<AvailabilityElementQuery
render={data => { render={data => {
const { availability } = data.dataYaml const { availability } = data.dataYaml
const { status, available, unavailable } = availability const { status, available, unavailable } = availability
@ -64,8 +58,4 @@ Availability.propTypes = {
hide: PropTypes.bool hide: PropTypes.bool
} }
AvailabilityElementQuery.propTypes = {
render: PropTypes.func
}
export default Availability export default Availability

View File

@ -15,31 +15,6 @@ const ProjectLink = ({ node }) => (
</Link> </Link>
) )
const ProjectNavQuery = ({ render }) => (
<StaticQuery
query={graphql`
query ProjectsNavQuery {
allProjectsYaml {
edges {
node {
title
slug
img {
childImageSharp {
fluid(maxWidth: 500, quality: 85) {
...GatsbyImageSharpFluid_noBase64
}
}
}
}
}
}
}
`}
render={render}
/>
)
class ProjectNav extends Component { class ProjectNav extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
@ -68,7 +43,26 @@ class ProjectNav extends Component {
const { slug } = this.props const { slug } = this.props
return ( return (
<ProjectNavQuery <StaticQuery
query={graphql`
query ProjectsNavQuery {
allProjectsYaml {
edges {
node {
title
slug
img {
childImageSharp {
fluid(maxWidth: 500, quality: 85) {
...GatsbyImageSharpFluid_noBase64
}
}
}
}
}
}
}
`}
render={data => { render={data => {
const projects = data.allProjectsYaml.edges const projects = data.allProjectsYaml.edges
@ -110,8 +104,4 @@ ProjectNav.propTypes = {
slug: PropTypes.string slug: PropTypes.string
} }
ProjectNavQuery.propTypes = {
render: PropTypes.func
}
export default ProjectNav export default ProjectNav