Download spectrum/src/components/fullscreenView/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/fullscreenView/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/components/fullscreenView/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/fullscreenView/index.js
1.49 kB
| // @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<Props> { | |
| 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 ( | |
| <FullscreenViewContainer> | |
| <CloseLink href={closePath}> | |
| <Icon glyph={'view-close'} size={32} /> | |
| </CloseLink> | |
| <Illustrations> | |
| <ClusterOne src="/img/cluster-2.svg" role="presentation" /> | |
| <ClusterTwo src="/img/cluster-1.svg" role="presentation" /> | |
| <ClusterThree src="/img/cluster-5.svg" role="presentation" /> | |
| <ClusterFour src="/img/cluster-4.svg" role="presentation" /> | |
| </Illustrations> | |
| {children} | |
| </FullscreenViewContainer> | |
| ); | |
| } | |
| } | |
| export default FullscreenView; | |