diff --git a/data/meta.json b/data/meta.json
index ced4b9a..ec19852 100644
--- a/data/meta.json
+++ b/data/meta.json
@@ -10,7 +10,11 @@
"GitHub": "https://github.com/kremalicious",
"Dribbble": "https://dribbble.com/kremalicious"
},
- "availability": true,
+ "availability": {
+ "status": true,
+ "available": "👔 Available for new projects. Let’s talk!",
+ "unavailable": "Not available for new projects."
+ },
"typekit": "dtg3zui",
"googleanalytics": "UA-1441794-4"
}
diff --git a/src/components/atoms/Animations.js b/src/components/atoms/Animations.js
index ae4fe59..12a7093 100644
--- a/src/components/atoms/Animations.js
+++ b/src/components/atoms/Animations.js
@@ -11,3 +11,13 @@ export const FadeIn = props => (
{...props}
/>
)
+
+export const MoveIn = props => (
+
+)
diff --git a/src/components/atoms/Animations.scss b/src/components/atoms/Animations.scss
index 758e569..837188b 100644
--- a/src/components/atoms/Animations.scss
+++ b/src/components/atoms/Animations.scss
@@ -1,18 +1,11 @@
-.fadein-appear {
- opacity: .01;
-
- &.fadein-appear-active {
- opacity: 1;
- transition: 400ms ease-in;
- }
-}
-
+.fadein-appear,
.fadein-enter {
opacity: .01;
+ &.fadein-appear-active,
&.fadein-enter-active {
opacity: 1;
- transition: 300ms ease-out;
+ transition: 400ms ease-in;
}
}
@@ -24,3 +17,27 @@
opacity: .01;
}
}
+
+.movein-appear,
+.movein-enter {
+ opacity: .01;
+ transform: translate3d(0, 3rem, 0);
+
+ &.movein-appear-active,
+ &.movein-enter-active {
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ transition: 300ms ease-out;
+ }
+}
+
+.movein-exit {
+ opacity: 1;
+ transform: translate3d(0, 0, 0);
+ transition: 100ms ease-out;
+
+ &.movein-exit-active {
+ opacity: .01;
+ transform: translate3d(0, 3rem, 0);
+ }
+}
diff --git a/src/components/molecules/Availability.js b/src/components/molecules/Availability.js
index fd1d146..ab3825c 100644
--- a/src/components/molecules/Availability.js
+++ b/src/components/molecules/Availability.js
@@ -1,37 +1,82 @@
-import React, { Fragment } from 'react'
+import React, { Fragment, Component } from 'react'
import PropTypes from 'prop-types'
-import { FadeIn } from '../atoms/Animations'
+import { MoveIn } from '../atoms/Animations'
import './Availability.scss'
-const Availability = ({ meta, hide }) => {
- const { availability, social } = meta
+class Availability extends Component {
+ constructor(props) {
+ super(props)
+ this.handleScroll = this.handleScroll.bind(this)
+ }
- const available = `👔 Available for new projects. Let’s talk!`
- const unavailable = 'Not available for new projects.'
+ componentDidMount() {
+ if (this.props.meta.availability.status === true) {
+ let supportsPassive = false
- return (
-
- {!hide && (
-
-
-
- )}
-
- )
+ try {
+ const opts = Object.defineProperty({}, 'passive', {
+ get: function() {
+ supportsPassive = true
+ },
+ })
+ window.addEventListener('test', null, opts)
+ } catch (e) {
+ return e
+ }
+
+ window.addEventListener('scroll', this.handleScroll, supportsPassive ? { passive: true } : false)
+ }
+ }
+
+ componentWillUnmount() {
+ window.removeEventListener('scroll', this.handleScroll)
+ }
+
+ handleScroll() {
+ let timeout
+ const footer = document.getElementsByClassName('footer')[0]
+ const availability = document.getElementsByClassName('availability')[0]
+
+ if (!timeout) {
+ timeout = setTimeout(function() {
+ timeout = null
+
+ if (footer.getBoundingClientRect().top <= window.innerHeight) {
+ availability.style.opacity = 0
+ window.removeEventListener('scroll', this.handleScroll)
+ } else {
+ availability.style.opacity = 1
+ }
+ }, 300)
+ }
+ }
+
+ render() {
+ const { availability } = this.props.meta
+ const { status, available, unavailable } = availability
+
+ return (
+
+ {!this.props.hide && (
+
+
+
+ )}
+
+ )
+ }
}
Availability.propTypes = {
diff --git a/src/components/molecules/Availability.scss b/src/components/molecules/Availability.scss
index 5198e1a..99034dc 100644
--- a/src/components/molecules/Availability.scss
+++ b/src/components/molecules/Availability.scss
@@ -9,6 +9,7 @@
z-index: 2;
padding: $spacer / 2;
display: block;
+ transition: opacity .2s ease-out;
p { margin-bottom: 0; }
@@ -17,4 +18,8 @@
position: fixed;
bottom: $spacer;
}
+
+ a {
+ border-bottom: 1px solid rgba($brand-cyan, .4);
+ }
}
diff --git a/src/components/organisms/Header.js b/src/components/organisms/Header.js
index 37963f0..49ed20a 100644
--- a/src/components/organisms/Header.js
+++ b/src/components/organisms/Header.js
@@ -23,7 +23,7 @@ const Header = ({ meta, isHomepage }) => {
-
+
)
}
diff --git a/src/layouts/index.js b/src/layouts/index.js
index 41f9919..2eece6b 100644
--- a/src/layouts/index.js
+++ b/src/layouts/index.js
@@ -73,7 +73,11 @@ export const query = graphql`
GitHub
Dribbble
}
- availability
+ availability {
+ status
+ available
+ unavailable
+ }
typekit
googleanalytics
}