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:
parent
ca348a3534
commit
4e06ef5b83
@ -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
|
||||
|
@ -111,7 +111,7 @@ ProjectNav.propTypes = {
|
||||
}
|
||||
|
||||
ProjectNavQuery.propTypes = {
|
||||
render: PropTypes.any
|
||||
render: PropTypes.func
|
||||
}
|
||||
|
||||
export default ProjectNav
|
||||
|
Loading…
Reference in New Issue
Block a user