From 542dc58244f828efd3be7b19d2ca1ec3dc1d2757 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 12 Jun 2018 10:39:03 +0200 Subject: [PATCH] remove availability scroll stuff --- src/components/molecules/Availability.jsx | 46 ----------------------- 1 file changed, 46 deletions(-) diff --git a/src/components/molecules/Availability.jsx b/src/components/molecules/Availability.jsx index e5094d4..e71b367 100644 --- a/src/components/molecules/Availability.jsx +++ b/src/components/molecules/Availability.jsx @@ -8,52 +8,6 @@ class Availability extends PureComponent { super(props) } - componentDidMount() { - if (this.props.meta.availability.status === true) { - let supportsPassive = false - - 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