diff --git a/package.json b/package.json index 13630f57..a41ce139 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "dependencies": { "algoliasearch": "^3.30.0", "async": "^2.6.0", + "classnames": "^2.2.6", "dominant-color": "^0.0.1", "glob": "^7.1.3", "image-average-color": "^1.0.0", diff --git a/src/App.css b/src/App.css index 6eabe69b..650534a5 100644 --- a/src/App.css +++ b/src/App.css @@ -74,6 +74,16 @@ body.overlay-open .overlay { margin: 10px; color: white; } + #focused-skin .metadata a { color: white; } + +#focused-skin .focused-preview { + -webkit-transition: opacity 400ms ease-in-out; + -moz-transition: opacity 400ms ease-in-out; + -ms-transition: opacity 400ms ease-in-out; +} +#focused-skin .focused-preview.loaded { + opacity: 0; +} diff --git a/src/FocusedSkin.js b/src/FocusedSkin.js index 0f664592..7b5d53b3 100644 --- a/src/FocusedSkin.js +++ b/src/FocusedSkin.js @@ -1,4 +1,5 @@ import React from "react"; +import ReactDOM from "react-dom"; import { connect } from "react-redux"; import WebampComponent from "./WebampComponent"; import * as Utils from "./utils"; @@ -19,7 +20,17 @@ class FocusedSkin extends React.Component { height: this.props.initialHeight }; } + this._imgWrapper = document.createElement("div"); + this._imgWrapper.style.zIndex = "10002"; + this._imgWrapper.style.position = "fixed"; + this._imgWrapper.style.top = 0; + document.body.appendChild(this._imgWrapper); } + + componentWillUnmount() { + document.body.removeChild(this._imgWrapper); + } + componentDidMount() { setTimeout(() => { // TODO: Observe DOM and recenter @@ -38,7 +49,7 @@ class FocusedSkin extends React.Component { }; } render() { - return ( + return ReactDOM.createPortal(
- + , + this._imgWrapper ); } } diff --git a/src/WebampComponent.js b/src/WebampComponent.js index 0a9b988a..3ff46a8c 100644 --- a/src/WebampComponent.js +++ b/src/WebampComponent.js @@ -1,5 +1,7 @@ import React from "react"; +import ReactDOM from "react-dom"; import { connect } from "react-redux"; +import classnames from "classnames"; import * as ActionCreators from "./redux/actionCreators"; class WebampComponent extends React.Component { @@ -42,7 +44,7 @@ class WebampComponent extends React.Component { } ], hotkeys: true, - zIndex: 99999 + zIndex: 1001 }); // TODO: Technically we should unsubscribe this on unmount @@ -50,27 +52,31 @@ class WebampComponent extends React.Component { setTimeout(async () => { await this._webamp.renderWhenReady(this._ref); + this.setState({ loading: false }); }, 400); if (this._unmounted === true) { return; } - // this.setState({ loading: false }); } render() { + const { loading } = this.state; return ( -