This repository has been archived on 2019-10-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tecnologiabanana/src/App.js
T

68 lines
2.8 KiB
JavaScript
Raw Normal View History

2018-11-08 18:08:07 +01:00
import React from 'react';
import { Route, Switch, Link } from 'react-router-dom'; // eslint-disable-line no-unused-vars
import 'bootstrap/dist/css/bootstrap.css'; // eslint-disable-line no-unused-vars
import { Row, Col, Button, Collapse } from 'react-bootstrap'; // eslint-disable-line no-unused-vars
2018-11-08 18:08:07 +01:00
import VideoList from './VideoList'; // eslint-disable-line no-unused-vars
import TopBar from './TopBar'; // eslint-disable-line no-unused-vars
import VideoPlayer from './VideoPlayer'; // eslint-disable-line no-unused-vars
2018-11-15 18:33:17 +01:00
import VideoInfo from './VideoInfo';
2018-12-14 17:53:15 +01:00
import {ReactHeight} from 'react-height';
import './css/App.css';
2018-12-14 17:48:29 +01:00
import Related from './reccomenders/Related';
2018-11-08 17:54:37 +01:00
2018-11-08 18:08:07 +01:00
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
2018-12-14 17:53:15 +01:00
maxHeight: null,
navHeight: null,
2018-12-14 17:02:49 +01:00
isInfoToggled: true
};
}
2018-12-14 17:48:29 +01:00
componentDidUpdate(prevProps,prevState,snapshot){
document.location.reload(true);
}
2018-11-08 18:08:07 +01:00
render() {
return (
<React.Fragment>
2018-12-14 17:53:15 +01:00
<ReactHeight className="row" onHeightReady={height => this.setState({navHeight:height})}>
<TopBar />
</ReactHeight>
<ReactHeight className="upperSection px-2 row" onHeightReady={height => this.setState({maxHeight:height})}>
<Col xs="12" lg={this.state.isInfoToggled ? { span: 6, offset: 1, order: 2 } : { span: 7, offset: 1, order: 2 }} className="align-content-center pt-2 p-1 pr-2">
<Route path={["/video/:id", "/*"]} component={VideoPlayer} />
2018-11-08 18:08:07 +01:00
</Col>
2018-12-14 17:53:15 +01:00
<Col xs="12" lg={this.state.isInfoToggled ? { span: 5, order: 1 } : { span: 3, order: 1 }} style={{ 'overflow': "auto", 'max-height': this.state.maxHeight }} className="w-75 h-100 py-2 p-0 p-sm-0">
<div className='d-flex justify-content-center pt-2'>
<Button variant="outline-light"
onClick={() => this.setState({ isInfoToggled: !this.state.isInfoToggled })}
className="w-75 align-content-center"
aria-controls="infovideo-collapse"
aria-expanded={this.state.isInfoToggled}>
{this.state.isInfoToggled ? "Nascondi informazioni" : "Mostra informazioni"}
</Button>
</div>
<Collapse in={this.state.isInfoToggled}>
<div className="pt-2" id="infovideo-collapse">
2018-12-14 17:48:29 +01:00
<Switch>
<Route path={["/video/:id", "/search/:query"]} component={VideoInfo} />
2018-12-14 17:48:29 +01:00
<Route path={["/"]} component={VideoInfo}/>
</Switch>
</div>
</Collapse>
2018-12-12 20:14:39 +01:00
</Col>
2018-12-14 17:53:15 +01:00
</ReactHeight>
<Row style={{"max-height": 'calc(99vh - '+this.state.maxHeight+'px - '+this.state.navHeight+'px)'}} className='downSection'>
<Switch>
<Route exact path='/' component={VideoList} />
<Route render={() => <div>URL not found</div>} />
2018-11-14 15:08:21 +01:00
</Switch>
2018-11-08 18:08:07 +01:00
</Row>
</React.Fragment>
);
}
2018-11-08 17:54:37 +01:00
}
export default App;