Skip to content

Commit

Permalink
Merge pull request #1066 from hackforla/1053-FRONT-boundaries
Browse files Browse the repository at this point in the history
Fixed disappearing NC boundaries
  • Loading branch information
adamkendis authored Apr 1, 2021
2 parents a7d8bf9 + 9c3fadd commit 72def55
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions client/Routes.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import {
Switch,
Route,
Redirect,
useLocation,
} from 'react-router-dom';
import Box from '@material-ui/core/Box';
import Desktop from '@components/main/Desktop';
import Reports from '@components/main/Reports';
import Privacy from '@components/main/Privacy';
Expand All @@ -8,17 +14,23 @@ import Blog from '@components/main/Blog';
import ContactForm from '@components/main/ContactForm';

export default function Routes() {
const { pathname } = useLocation();

return (
<Switch>
<Route path="/map" component={Desktop} />
<Route path="/reports" component={Reports} />
<Route path="/privacy" component={Privacy} />
<Route path="/faqs" component={Faqs} />
<Route path="/blog" component={Blog} />
<Route path="/contact" component={ContactForm} />
<Route path="/">
<Redirect to="map" />
</Route>
</Switch>
<>
<Box visibility={pathname !== '/map' ? 'hidden' : 'visible'}>
<Desktop />
</Box>
<Switch>
<Route path="/reports" component={Reports} />
<Route path="/privacy" component={Privacy} />
<Route path="/faqs" component={Faqs} />
<Route path="/blog" component={Blog} />
<Route path="/contact" component={ContactForm} />
<Route path="/">
<Redirect to="map" />
</Route>
</Switch>
</>
);
}

0 comments on commit 72def55

Please sign in to comment.