Skip to content

Commit

Permalink
chore: header pin changes (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp authored Mar 25, 2024
1 parent 1f00b3a commit 998c8ba
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 50 deletions.
67 changes: 42 additions & 25 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { fetchOMRRData } from '@/features/omrr/omrr-slice'
import { useEffect } from 'react'
import { RootState } from '@/app/store'
import CircularProgress from '@mui/material/CircularProgress'
import Snackbar from '@mui/material/Snackbar'
import 'leaflet/dist/leaflet.css'
import { Snackbar } from '@mui/material'

export default function App() {
const status: string = useSelector((state: RootState) => state.omrr.status)
Expand All @@ -20,31 +20,48 @@ export default function App() {
}, [dispatch])
return (
<Grid container sx={{ flexGrow: 1 }}>
<Grid item xs={12}>
<Header />
</Grid>
<Grid item xs={12}>
{status === 'loading' ? (
<CircularProgress />
) : status === 'failed' ? (
<Snackbar
message="Loading Failed, Please try later refreshing the page"
sx={{ background: '#fffffff', backgroundColor: '#fffffff' }}
color="error"
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
autoHideDuration={6000}
draggable
open={true}
></Snackbar>
) : (
<BrowserRouter>
{status === 'loading' ? (
<><Grid item xs={12}>
<Header />
</Grid>
<Grid item xs={12}>
<CircularProgress />
</Grid>
<Grid item xs={12}>
<Footer />
</Grid></>
) : status === 'failed' ? (
<><Grid item xs={12}>
<Header />
</Grid>
<Grid item xs={12}>
<Snackbar
message="Loading Failed, Please try later refreshing the page"
sx={{ background: '#fffffff', backgroundColor: '#fffffff' }}
color="error"
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
autoHideDuration={6000}
draggable
open={true}
></Snackbar>
</Grid>
<Grid item xs={12}>
<Footer />
</Grid></>
) : (
<><BrowserRouter>
<Grid item xs={12}>
<Header />
</Grid>
<Grid item xs={12}>
<AppRoutes />
</BrowserRouter>
)}
</Grid>
<Grid item xs={12}>
<Footer />
</Grid>
</Grid>
<Grid item xs={12}>
<Footer />
</Grid>
</BrowserRouter></>
)}

</Grid>
)
}
10 changes: 5 additions & 5 deletions frontend/src/components/AuthorizationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ export default function AuthorizationDetails() {
//read from assets
iconUrl: pin,
shadowUrl: shadow,
iconSize: [25, 41],
iconAnchor: [12, 41],
iconSize: [50, 82],
iconAnchor: [25, 82],
popupAnchor: [1, -34],
shadowSize: [41, 41],
shadowSize: [82, 82],
})
const navigate = useNavigate()
const buttonClicked = (route: any) => {
Expand Down Expand Up @@ -212,8 +212,8 @@ export default function AuthorizationDetails() {
<MapContainer
id="map"
center={facilityLocation}
scrollWheelZoom={false}
zoom={12}
scrollWheelZoom={true}
zoom={14}
style={{ height: '60em' }}
className="map-container"
>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function Dashboard() {
height: '100%',
backgroundImage: `url(${homePageBanner})`,
backgroundSize: 'cover',
backgroundPosition: 'left',
backgroundPosition: 'center',
}}
/>
<Stack>
Expand Down
88 changes: 69 additions & 19 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import BCGovLogo from '@/assets/gov-bc-logo-horiz.png'
import { AppBar, IconButton, Toolbar } from '@mui/material'
import Typography from '@mui/material/Typography'
import { HomeRounded, Menu } from '@mui/icons-material'
import { Feed, Menu } from '@mui/icons-material'
import Stack from '@mui/material/Stack'
import { useTheme } from '@mui/material/styles'
import useMediaQuery from '@mui/material/useMediaQuery'

const styles = {
appBar: {
color: '#ffffff',
Expand All @@ -10,25 +13,72 @@ const styles = {
},
}
export default function Header() {
const theme = useTheme()
const mdMatches = useMediaQuery(theme.breakpoints.up('md'))
return (
<AppBar position="fixed" sx={styles.appBar}>
<Toolbar sx={{ justifyContent: 'space-between' }} id="back-to-top-anchor">
<img alt="Logo" src={BCGovLogo} />
<Typography sx={{
fontFamily: 'BCSans',
fontStyle: 'normal',
fontWeight: 400,
fontSize: '1.5em',
lineHeight: '2.25em',
color:' #FFFFFF'
}}>
Organics Info
</Typography>
<a href={'/'} target={'_self'}>
<IconButton>
<Menu color="secondary"></Menu>
</IconButton>
</a>
<Toolbar
sx={{
flexDirection: 'row',
alignItems: 'center',
alignContent: 'center',
justifyContent: 'space-between',
}}
id="back-to-top-anchor"
>
<Stack direction="row" id="logo_name">
<a href="/">
<img alt="Logo" src={BCGovLogo} />
</a>
<div>
{' '}
<span
style={{
fontFamily: 'BCSans',
fontSize: '1.5em',
lineHeight: '2.25em',
marginLeft: '1em',
alignItems: 'center',
}}
>
Organics Info
</span>
</div>
</Stack>
<Stack direction="row" id="nav">
{mdMatches && (
<div>
<a
href={'/search'}
target={'_self'}
style={{ textDecoration: 'none' }}
>
<IconButton>
<Feed color="secondary"></Feed>
</IconButton>
<span
style={{
color: '#ffffff',
textDecoration: 'none',
textTransform: 'none',
}}
>
{' '}
Text Search
</span>
</a>
</div>
)}
{!mdMatches && (
<div>
<a href={'/search'} target={'_self'}>
<IconButton>
<Menu color="secondary"></Menu>
</IconButton>
</a>
</div>
)}
</Stack>
</Toolbar>
</AppBar>
)
Expand Down

0 comments on commit 998c8ba

Please sign in to comment.