Fixing parallax state

This commit is contained in:
James Barnsley
2020-03-13 07:09:37 +13:00
parent 28fc55bad1
commit d37fa271f3
5 changed files with 31 additions and 37 deletions

View File

@ -24,7 +24,7 @@ export default class Parallax extends React.Component {
componentDidUpdate = () => {
const { image } = this.props;
const { url } = this.state;
if (image !== url) this.loadImage(image);
if (image && image !== url) this.loadImage(image);
}
loadImage(url) {
@ -58,6 +58,7 @@ export default class Parallax extends React.Component {
const {
blur,
fixedHeight,
image,
animate = true,
} = this.props;
const {

View File

@ -48,20 +48,11 @@ class DiscoverNewReleases extends React.Component {
this.props.uiActions.showContextMenu(data);
}
renderIntro(album = null) {
if (album) {
return (
<div className="intro preserve-3d">
<Parallax image={album.images ? album.images.large : null} blur />
</div>
);
}
return (
<div className="intro preserve-3d">
<Parallax />
</div>
);
}
renderIntro = ({ images: { large } = {} } = {}) => (
<div className="intro preserve-3d">
<Parallax image={large} blur />
</div>
);
render() {
if (isLoading(this.props.load_queue, ['spotify_browse/new-releases'])) {