From facc64b23f0c28fb45d9d1cdb9096a88ee581a31 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 22 Apr 2021 15:23:43 +0200 Subject: landscape stuff --- .../projects/museum/views/landscape.warning.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 frontend/site/projects/museum/views/landscape.warning.js (limited to 'frontend/site/projects/museum/views/landscape.warning.js') diff --git a/frontend/site/projects/museum/views/landscape.warning.js b/frontend/site/projects/museum/views/landscape.warning.js new file mode 100644 index 0000000..eeb504c --- /dev/null +++ b/frontend/site/projects/museum/views/landscape.warning.js @@ -0,0 +1,49 @@ +import React, { Component } from 'react' + +import './landscape.warning.css' + +import { LastMuseumLogoNoBlur } from '../icons' + +const PhoneIcon = ( + + + +) + +const RotateIcon = ( + + + +) + +export default class LandscapeWarning extends Component { + state = { + landscape: false, + } + constructor(props) { + super(props) + this.handleResize = this.handleResize.bind(this) + window.addEventListener("resize", this.handleResize) + this.handleResize() + } + + handleResize() { + const landscape = 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} +
{'Please rotate your device'}
+
+ ) + } +} \ No newline at end of file -- cgit v1.2.3-70-g09d2