1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2025-01-06 11:45:33 +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
src/components/molecules

View File

@ -4,13 +4,7 @@ import { StaticQuery, graphql } from 'gatsby'
import { MoveIn } from '../atoms/Animations'
import styles from './Availability.module.scss'
class Availability extends PureComponent {
constructor(props) {
super(props)
}
render() {
return (
const AvailabilityElementQuery = ({ render }) => (
<StaticQuery
query={graphql`
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 => {
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