/** * Instruction to rotate the phone to landscape */ import React, { Component } from "react"; import { isMobile, isiPhone, isDesktop } from "../utils/index.js"; const PhoneIcon = ( ); const RotateIcon = ( ); export default class LandscapeWarning extends Component { constructor(props) { super(props); this.state = { landscape: window.innerWidth > window.innerHeight, }; this.handleResize = this.handleResize.bind(this); window.addEventListener("resize", this.handleResize); setTimeout(this.handleResize, 100); } handleResize() { const landscape = window.innerWidth > window.innerHeight; if (landscape !== this.state.landscape) { this.setState({ landscape }); } } render() { const { landscape } = this.state; if (landscape) return null; if (isDesktop) { return (
{"← Please make your window wider →"}
); } return (
{RotateIcon} {PhoneIcon} {isiPhone ? (
{"Please tap "} A {"A and Hide Toolbar"}
{"then rotate your device."}
) : (
{"Please rotate your device"}
)}
); } }