import React from 'react'; import "./css/App.css" import HomePage from "./pages/HomePage"; import RandomPage from "./pages/RandomPage"; // include bootstraps css import 'bootstrap/dist/css/bootstrap.min.css'; import SettingsPage from "./pages/SettingsPage"; import CategoryPage from "./pages/CategoryPage"; class App extends React.Component { constructor(props, context) { super(props, context); this.state = {page: "default"}; // bind this to the method for being able to call methods such as this.setstate this.showVideo = this.showVideo.bind(this); this.hideVideo = this.hideVideo.bind(this); } videoelement = null; MainBody() { let page; if (this.state.page === "default") { page = ; this.mypage = page; } else if (this.state.page === "random") { page = ; this.mypage = page; } else if (this.state.page === "settings") { page = ; this.mypage = page; } else if (this.state.page === "categories") { page = ; this.mypage = page; } else if (this.state.page === "video") { // show videoelement if neccessary page = this.videoelement; console.log(page); } else if (this.state.page === "lastpage") { // return back to last page page = this.mypage; } else { page =
unimplemented yet!
; } return (page); } render() { return (
{this.MainBody()}
); } showVideo(element) { this.videoelement = element; this.setState({ page: "video" }); } hideVideo() { this.setState({ page: "lastpage" }); this.element = null; } } export default App;