1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +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,13 +4,7 @@ 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'
class Availability extends PureComponent { const AvailabilityElementQuery = ({ render }) => (
constructor(props) {
super(props)
}
render() {
return (
<StaticQuery <StaticQuery
query={graphql` query={graphql`
query AvailabilityQuery { query AvailabilityQuery {
@ -23,6 +17,18 @@ class Availability extends PureComponent {
} }
} }
`} `}
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
@ -58,4 +64,8 @@ Availability.propTypes = {
hide: PropTypes.bool hide: PropTypes.bool
} }
AvailabilityElementQuery.propTypes = {
render: PropTypes.func
}
export default Availability export default Availability

View File

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