1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 17:23:22 +01:00

refactor availability component

This commit is contained in:
Matthias Kretschmann 2018-06-22 19:01:29 +02:00
parent ca348a3534
commit 4e06ef5b83
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 23 additions and 13 deletions

View File

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

View File

@ -111,7 +111,7 @@ ProjectNav.propTypes = {
}
ProjectNavQuery.propTypes = {
render: PropTypes.any
render: PropTypes.func
}
export default ProjectNav