Skip to content

Commit

Permalink
Enabling home button clickable feature
Browse files Browse the repository at this point in the history
  • Loading branch information
raima-zachariah committed Apr 25, 2020
1 parent 5515b67 commit 51df59e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
14 changes: 12 additions & 2 deletions simplq/src/components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';
import Link from '@material-ui/core/Link';
import Routes from './Routes'
import Button from '@material-ui/core/Button';
import { withRouter } from "react-router";

function Copyright() {
return (
Expand All @@ -26,15 +28,21 @@ const useStyles = makeStyles((theme) => ({
}
}));

export default function Layout() {
const handleClick = (props) => {
props.history.push("/");
}

function Layout(props) {
const classes = useStyles();

return (
<>
<AppBar position="relative">
<Toolbar>
<Typography variant="h6" color="inherit" noWrap>
SQ
<Button color="inherit" onClick={() => handleClick(props)}>
SQ
</Button>
</Typography>
</Toolbar>
</AppBar>
Expand All @@ -47,3 +55,5 @@ export default function Layout() {
</>
);
}

export default withRouter(Layout);
5 changes: 2 additions & 3 deletions simplq/src/components/Routes.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import {
BrowserRouter as Router,
Route
} from "react-router-dom";
import CreateQueue from "./page/CreateQueue"
Expand All @@ -9,10 +8,10 @@ import QueueStatus from "./page/QueueStatus";
import Admin from "./page/admin/index";

export default () => {
return <Router>
return <>
<Route path="/" exact component={CreateQueue} />
<Route path="/admin/:queueId" exact component={Admin} />
<Route path="/:queueId" exact component={JoinQueue} />
<Route path="/status/:queueId/:tokenId" exact component={QueueStatus} />
</Router>
</>
}
7 changes: 4 additions & 3 deletions simplq/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import './index.css';
import Layout from './components/Layout';
import * as serviceWorker from './serviceWorker';
import Routes from './components/Routes';
import {
BrowserRouter as Router
} from "react-router-dom";

ReactDOM.render(
<React.StrictMode>
<Layout>
<Routes />
</Layout>
<Router> <Layout /> </Router>
</React.StrictMode>,
document.getElementById('root')
);
Expand Down

0 comments on commit 51df59e

Please sign in to comment.