diff options
author | Eug-VS <eug-vs@keemail.me> | 2020-01-02 23:46:17 +0300 |
---|---|---|
committer | Eug-VS <eug-vs@keemail.me> | 2020-01-02 23:46:17 +0300 |
commit | 3cc00d726e40886d64b2554fb0c48571621d4191 (patch) | |
tree | 845802bfa1adcd5a711be12e2a0ce88bfe731eee /src/index.js | |
parent | 73eae8e0b49ebe4d85efdc7e6913d7c03e7d543c (diff) | |
parent | 2b917f53e806191340a7a26bef3468320dd29917 (diff) | |
download | chrono-cube-ui-3cc00d726e40886d64b2554fb0c48571621d4191.tar.gz |
Merge branch 'master' into theme
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/index.js b/src/index.js index bacf937..a397310 100644 --- a/src/index.js +++ b/src/index.js @@ -10,6 +10,7 @@ import { ThemeProvider, makeStyles } from '@material-ui/core/styles'; import theme from "./theme"; import Header from './components/Header/Header'; +import Timer from './components/Timer/Timer'; import Scoreboard from "./components/Scoreboard/Scoreboard"; @@ -25,23 +26,30 @@ const App = () => { const [page, setPage] = useState('app'); const classes = useStyles(); + + 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> + ) + } + }; + return ( <ThemeProvider theme={theme}> <CssBaseline/> <Header setPage={setPage}/> <Box className={classes.root}> <Typography variant="h4"> This is the {page} page! </Typography> - { - (page === 'scoreboard')? - (<Scoreboard/>) - : - ( - <p> - This text is rendered outside of <code>Header</code> component, but - interacting with <code>Header</code> can influence content of this page! - </p> - ) - } + { getPageComponent(page) } </Box> </ThemeProvider> ); |