Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mobile nav menu styles #1237

Merged
merged 5 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/layout/AppNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ export default function AppNavBar({ navMenuToggle }: AppBarDeckProps) {
overflow: 'hidden',
transition: 'height .5s, background-color .5s ease 0s',
height: theme.spacing(11),
[theme.breakpoints.down('md')]: {
[theme.breakpoints.down('sm')]: {
height: theme.spacing(8),
},
'&.shrink': {
height: theme.spacing(8),
lineHeight: theme.spacing(8),
backgroundColor: 'hsla(0,0%,100%,0.85)',
backdropFilter: 'saturate(180%) blur(5px)',

[theme.breakpoints.down('sm')]: {
height: theme.spacing(7),
},
},
backgroundColor: theme.palette.common.white,
})}>
Expand All @@ -47,6 +51,7 @@ export default function AppNavBar({ navMenuToggle }: AppBarDeckProps) {
height: '100%',
display: 'flex',
justifyContent: 'space-between',
padding: 0,
}}>
<Link href={routes.index} passHref>
<ButtonBase
Expand All @@ -64,9 +69,6 @@ export default function AppNavBar({ navMenuToggle }: AppBarDeckProps) {
width: '100%',
height: theme.spacing(5),
},
'&.shrink': {
height: '50%',
},
'& > svg': {
display: 'block',
height: '100%',
Expand Down
11 changes: 7 additions & 4 deletions src/components/layout/nav/AuthLinks/AuthLinks.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@ export const AuthLinksWrapper = styled(Box)(() => ({
display: 'flex',
alignItems: 'center',
borderTop: '2px solid lightgrey',
marginLeft: theme.spacing(0.25),
minHeight: theme.spacing(8),
paddingLeft: theme.spacing(1),
minHeight: theme.spacing(8),
}))

export const AuthLink = styled(LinkButton)(() => ({
color: theme.palette.common.black,
display: 'contents',
textAlign: 'start',
padding: 0,
}))

export const SlashSymbol = styled('span')(() => ({
display: 'flex',
alignItems: 'center',
padding: theme.spacing(0, 1.5),
}))

export const ProfileLogOut = styled(LinkButton)(() => ({
export const StyledAuthButton = styled(LinkButton)(() => ({
justifyContent: 'left',
fontWeight: 500,
minHeight: theme.spacing(8),
padding: theme.spacing(0, 2),
padding: theme.spacing(0, 1),
borderTop: '2px solid lightgrey',
borderRadius: 0,
color: theme.palette.common.black,
Expand Down
16 changes: 8 additions & 8 deletions src/components/layout/nav/AuthLinks/AuthLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import React from 'react'
import { useTranslation } from 'next-i18next'
import { useSession } from 'next-auth/react'

import { Grid, Button } from '@mui/material'
import { Grid } from '@mui/material'
import { isAdmin } from 'common/util/roles'
import { routes } from 'common/routes'

import { AuthLink, AuthLinksWrapper, ProfileLogOut, SlashSymbol } from './AuthLinks.styled'
import { AuthLink, AuthLinksWrapper, StyledAuthButton, SlashSymbol } from './AuthLinks.styled'

export const AuthLinks = () => {
const { t } = useTranslation()
Expand All @@ -18,21 +18,21 @@ export const AuthLinks = () => {
return (
<>
<Grid item>
<ProfileLogOut fullWidth href={routes.profile.index}>
<StyledAuthButton fullWidth href={routes.profile.index}>
{t('nav.profile')}
</ProfileLogOut>
</StyledAuthButton>
</Grid>
{status === 'authenticated' && isAdmin(session) && (
<Grid item>
<Button fullWidth href={routes.admin.index}>
<StyledAuthButton fullWidth href={routes.admin.index}>
{t('nav.admin.index')}
</Button>
</StyledAuthButton>
</Grid>
)}
<Grid item>
<ProfileLogOut fullWidth href={routes.logout}>
<StyledAuthButton fullWidth href={routes.logout}>
{t('nav.logout')}
</ProfileLogOut>
</StyledAuthButton>
</Grid>
</>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/DonationMenuMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
[`& .${classes.accordionSummary}`]: {
fontWeight: 500,
minHeight: theme.spacing(8),
padding: theme.spacing(0, 3),
padding: theme.spacing(0, 1),
},

[`& .${classes.menuItem}`]: {
Expand Down
13 changes: 7 additions & 6 deletions src/components/layout/nav/MobileNav/MobileNav.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ import Grid from 'components/recurring-donation/grid/Grid'
import LinkButton from 'components/common/LinkButton'

export const CloseButton = styled(CloseModalButton)(() => ({
marginRight: theme.spacing(1.25),
right: theme.spacing(1.25),
right: theme.spacing(0.5),
top: theme.spacing(0.25),
}))

export const OpenMenuHeader = styled(Box)(() => ({
margin: theme.spacing(0.5, 3, 2),
margin: theme.spacing(0.5, 0, 1.5),
height: theme.spacing(5),
display: 'flex',
}))

export const NavMenuWrapper = styled(Box)(() => ({
display: 'flex',
justifyContent: 'center',
padding: theme.spacing(2),
padding: theme.spacing(1, 2),
flexDirection: 'column',
}))

Expand All @@ -42,11 +43,11 @@ export const LocaleButtonWrapper = styled(Box)(() => ({
borderBottom: '2px solid lightgrey',
display: 'flex',
minHeight: theme.spacing(8),
paddingLeft: theme.spacing(1),

'& button': {
justifyContent: 'start',
marginLeft: theme.spacing(1.3),
marginLeft: theme.spacing(1),
padding: 0,
fontSize: theme.typography.pxToRem(14),
},
}))
5 changes: 3 additions & 2 deletions src/components/layout/nav/MobileNav/MobileNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import Link from 'next/link'
import { SwipeableDrawer, Hidden, Grid } from '@mui/material'
import FavoriteIcon from '@mui/icons-material/Favorite'

import PodkrepiLogo from 'components/brand/PodkrepiLogo'
import LocaleButton from '../../LocaleButton'
import DonationMenuMobile from '../DonationMenuMobile'
import ProjectMenuMobile from '../ProjectMenuMobile'
import { AuthLinks } from '../AuthLinks/AuthLinks'
import { routes } from 'common/routes'
import PodkrepiIcon from 'components/brand/PodkrepiIcon'

import {
CloseButton,
Expand All @@ -31,6 +31,7 @@ export default function MobileNav({ mobileOpen, setMobileOpen }: NavDeckProps) {
const { t } = useTranslation()

const router = useRouter()
const { locale } = useRouter()
const closeNavMenu = () => setMobileOpen(false)

// Register route change event handlers
Expand All @@ -54,7 +55,7 @@ export default function MobileNav({ mobileOpen, setMobileOpen }: NavDeckProps) {
<NavMenuWrapper>
<OpenMenuHeader>
<Link href={routes.index} passHref>
<PodkrepiIcon />
<PodkrepiLogo locale={locale} variant="adaptive" />
</Link>
<CloseButton edge="end" fontSize="large" onClose={closeNavMenu} />
</OpenMenuHeader>
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/nav/ProjectMenuMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const StyledAccordion = styled(Accordion)(({ theme }) => ({
[`& .${classes.accordionSummary}`]: {
fontWeight: 500,
minHeight: theme.spacing(8),
padding: theme.spacing(0, 3),
padding: theme.spacing(0, 1),
},

[`& .${classes.menuItem}`]: {
Expand Down