diff --git a/src/App.css b/src/App.css index 46717544..d5fec1b0 100644 --- a/src/App.css +++ b/src/App.css @@ -133,10 +133,6 @@ button:active { margin-top: 46px; /* This matches the height of #search */ } -body.overlay-open { - overflow: hidden; -} - #webamp { opacity: 0; transition: opacity 400ms ease-in-out; @@ -163,32 +159,6 @@ body.webamp-loaded #webamp { backface-visibility: hidden; } -.overlay { - z-index: 1000; - position: fixed; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0); - transition: background-color 400ms ease-out; -} - -body.overlay-open .overlay { - background: rgba(0, 0, 0, 0.95); -} - -#close-modal { - color: #a7a394; - position: fixed; - top: 10px; - right: 10px; - padding: 0; - font-size: 50px; - line-height: 25px; - text-decoration: none; -} - .metadata { position: absolute; margin: 10px; diff --git a/src/Overlay.js b/src/Overlay.js index 3dc8e030..fce23034 100644 --- a/src/Overlay.js +++ b/src/Overlay.js @@ -1,97 +1,10 @@ -import React from "react"; -import ReactDOM from "react-dom"; import { connect } from "react-redux"; import * as ActionCreators from "./redux/actionCreators"; - -class Overlay extends React.Component { - constructor() { - super(); - this._node = document.createElement("div"); - this._node.classList.add("overlay"); - this._handleKeyDown = this._handleKeyDown.bind(this); - this._handleClick = this._handleClick.bind(this); - this._handleTouchMove = this._handleTouchMove.bind(this); - - window.document.body.appendChild(this._node); - } - - componentDidMount() { - window.document.addEventListener("keydown", this._handleKeyDown); - window.document.addEventListener("touchmove", this._handleTouchMove); - // TODO: This is technically a race condition, since we could unmount before this fires. - if (this.props.shouldAnimate) { - setTimeout(() => { - // This does not seem to work the first time. - // This should _not_ work on page load - document.body.classList.add("overlay-open"); - }, 0); - } else { - document.body.classList.add("overlay-open"); - } - } - - componentWillUnmount() { - window.document.body.removeChild(this._node); - window.document.removeEventListener("keydown", this._handleKeyDown); - window.document.removeEventListener("touchmove", this._handleTouchMove); - document.body.classList.remove("overlay-open"); - } - - _handleTouchMove(e) { - e.preventDefault(); - } - - _handleKeyDown(e) { - // Esc - if (e.keyCode === 27) { - this.props.closeModal(); - } - } - - _handleClick(e) { - if (e.target === e.currentTarget) { - this.props.closeModal(); - } - } - render() { - return ReactDOM.createPortal( -