import React from 'react'; import { connect } from "react-redux"; import Calculator from './Calculator'; import { colors } from './globals' import { innerWindowWidthAction } from "./actions/innerWindowWidthAction"; import { innerWindowHeightAction } from "./actions/innerWindowHeightAction"; const mapStateToProps = (state) => ({ ...state }); const mapDispatchToProps = (dispatch) => ({ innerWindowWidthAction: (windowInnerWidth) => dispatch(innerWindowWidthAction(windowInnerWidth)), innerWindowHeightAction: (windowInnerHeight) => dispatch(innerWindowHeightAction(windowInnerHeight)), }); class App extends React.Component { constructor(props) { super(props); this.handleResize = this.handleResize.bind(this); }; handleResize() { this.props.innerWindowWidthAction(window.innerWidth); this.props.innerWindowHeightAction(window.innerHeight); }; componentDidMount() { window.addEventListener('resize',this.handleResize); }; componentWillUnmount() { window.removeEventListener('resize',this.handleResize); }; render() { const height = this.props.innerWindowHeight; const width = this.props.innerWindowWidth; const gitHubLabelStyle = { backgroundColor: colors.firstColor, border: 'none', width: 149, height: 0, position: 'absolute', right: 0, }; const attachmentStyle = { position: 'absolute', right: 0, height: 149, width: 149, }; const style = { textAlign: 'center', backgroundColor: colors.firstColor, height: '100vh', width: '100vw', display: 'flex', color: colors.textColor, overFlow: 'hidden', }; if (width > height && height < 400) { gitHubLabelStyle['width'] = 99; attachmentStyle['width'] = 99; attachmentStyle['height'] = 99; } else if (height > width) { gitHubLabelStyle['width'] = 99; attachmentStyle['width'] = 99; attachmentStyle['height'] = 99; } return (
); }; }; export default connect(mapStateToProps, mapDispatchToProps)(App);