diff options
author | Eugene <eug-vs@keemail.me> | 2020-01-02 20:19:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-02 20:19:22 +0000 |
commit | c17e83619f4ec7783261ea9ba2a4dffc8b5cad49 (patch) | |
tree | 7366f1896c07973a0e1f6be2a00a8e7b1ac16efb /src/index.js | |
parent | 1398e9579be8a0ad478ef16085b431fbb97311f1 (diff) | |
parent | 6bc5060db0f87a767a3caa2be6cf68d243b8d70f (diff) | |
download | chrono-cube-ui-c17e83619f4ec7783261ea9ba2a4dffc8b5cad49.tar.gz |
Merge branch 'master' into timer
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/index.js b/src/index.js index f062952..de4cb2a 100644 --- a/src/index.js +++ b/src/index.js @@ -1,31 +1,52 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; +import { + Typography, + Paper, + Container, +} from "@material-ui/core"; + import styled from 'styled-components'; import CssBaseline from '@material-ui/core/CssBaseline' import Header from './components/Header/Header'; import Timer from './components/Timer/Timer'; +import Scoreboard from "./components/Scoreboard/Scoreboard"; const App = () => { const [page, setPage] = useState('app'); + const getPageComponent = page => { + switch (page) { + case 'app': + return (<Timer/>); + case 'scoreboard': + return (<Scoreboard/>); + default: + return ( + <p> + This text is rendered outside of <code>Header</code> component, but + interacting with <code>Header</code> can influence content of this page! + </p> + ) + } + }; + + const classes = useStyles(); return ( - <Root> + <ThemeProvider theme={theme}> <CssBaseline/> - <Header setPage={setPage} /> - <h1> This is the {page} page! </h1> - <p> - This text is rendered outside of <code>Header</code> component, but - interacting with <code>Header</code> can influence content of this page! - </p> - <Timer /> - </Root> + <Header setPage={setPage}/> + <Box className={classes.root}> + <Typography variant="h4"> This is the {page} page! </Typography> + { getPageComponent(page)} + </Box> + </ThemeProvider> ); }; - const Root = styled.div` background: cornsilk; padding-bottom: 25px; |