/** * Instruction to rotate the phone to landscape */ import React, { Component } from 'react' import './landscape.warning.css' import { isMobile, isiPhone } from 'app/utils' import { LastMuseumLogoNoBlur } from '../icons' const PhoneIcon = ( ) const RotateIcon = ( ) export default class LandscapeWarning extends Component { state = { landscape: !isMobile || window.innerWidth > window.innerHeight, } constructor(props) { super(props) this.handleResize = this.handleResize.bind(this) if (isMobile) { window.addEventListener("resize", this.handleResize) setTimeout(this.handleResize, 100) } } handleResize() { const landscape = !isMobile || window.innerWidth > window.innerHeight if (landscape !== this.state.landscape) { this.setState({ landscape }) } } render() { const { landscape } = this.state if (landscape) return null return (
{RotateIcon} {PhoneIcon} {LastMuseumLogoNoBlur} {isiPhone &&
{'Please tap '}A{'A and Hide Toolbar'}{ToolbarSymbol}
{'then rotate your device.'}
} {!isiPhone &&
{'Please rotate your device'}
}
) } } const ToolbarSymbol = ( )