// @flow import React, { Component } from 'react'; import { ClusterOne, ClusterTwo, ClusterThree, ClusterFour, } from 'src/components/illustrations'; import Icon from 'src/components/icon'; import { FullscreenViewContainer, Illustrations, CloseLink } from './style'; import { ESC } from 'src/helpers/keycodes'; type Props = { closePath: string, children: any, }; class FullscreenView extends Component { componentDidMount() { document.addEventListener('keydown', this.handleKeyPress, false); } componentWillUnmount() { document.removeEventListener('keydown', this.handleKeyPress, false); } handleKeyPress = (e: any) => { const { closePath } = this.props; // if person taps esc, close the dialog if (closePath && e.keyCode === ESC) { return (window.location = closePath); } }; render() { const { closePath, children } = this.props; return ( {children} ); } } export default FullscreenView;