diff --git a/public/img/header-image.png b/public/img/header-image.png deleted file mode 100644 index 752c981b8..000000000 Binary files a/public/img/header-image.png and /dev/null differ diff --git a/src/components/brand/PodkrepiLogo.tsx b/src/components/brand/PodkrepiLogo.tsx index a4e6f4bc9..4f85516bc 100644 --- a/src/components/brand/PodkrepiLogo.tsx +++ b/src/components/brand/PodkrepiLogo.tsx @@ -1,7 +1,6 @@ import React from 'react' import { styled } from '@mui/material/styles' -import theme from 'common/theme' import SVGLogoBetaBG from './podkrepi-logo-beta-bg' import SVGLogoBetaEN from './podkrepi-logo-beta-en' diff --git a/src/components/layout/nav/AuthLinks.tsx b/src/components/layout/nav/AuthLinks.tsx new file mode 100644 index 000000000..f910d9846 --- /dev/null +++ b/src/components/layout/nav/AuthLinks.tsx @@ -0,0 +1,69 @@ +import React from 'react' +import { useTranslation } from 'next-i18next' +import { Grid, Button, Theme } from '@mui/material' +import { isAdmin } from 'common/util/roles' +import { routes } from 'common/routes' +import LinkButton from 'components/common/LinkButton' +import { useSession } from 'next-auth/react' +import { createStyles, makeStyles } from '@mui/styles' + +const useStyles = makeStyles((theme: Theme) => + createStyles({ + authLinksWrapper: { + display: 'flex', + borderTop: '2px solid lightgrey', + marginLeft: theme.spacing(0.25), + minHeight: theme.spacing(8), + }, + authLink: { + color: theme.palette.common.black, + }, + slashSymbol: { + display: 'flex', + alignItems: 'center', + }, + }), +) + +export const AuthLinks = () => { + const { data: session, status } = useSession() + const { t } = useTranslation() + const classes = useStyles() + + if (session) { + return ( + <> + + + {t('nav.profile')} + + + {status === 'authenticated' && isAdmin(session) && ( + + + + )} + + + {t('nav.logout')} + + + + ) + } + return ( + <> + + + {t('nav.login')} + + / + + {t('nav.register')} + + + + ) +} diff --git a/src/components/layout/nav/DonationMenuMobile.tsx b/src/components/layout/nav/DonationMenuMobile.tsx index 6efb7118e..f439af29d 100644 --- a/src/components/layout/nav/DonationMenuMobile.tsx +++ b/src/components/layout/nav/DonationMenuMobile.tsx @@ -5,8 +5,8 @@ import AccordionSummary from '@mui/material/AccordionSummary' import AccordionDetails from '@mui/material/AccordionDetails' import ExpandMoreIcon from '@mui/icons-material/ExpandMore' import LinkButton from 'components/common/LinkButton' -import { routes } from 'common/routes' import { useTranslation } from 'next-i18next' +import { navItems } from './DonationMenu' const PREFIX = 'DonationMenuMobile' @@ -19,27 +19,23 @@ const classes = { const StyledAccordion = styled(Accordion)(({ theme }) => ({ [`&.${classes.accordionWrapper}`]: { boxShadow: 'none', - border: '2px solid rgba(50, 169, 254, 0.5)', - borderRadius: '25px !important', - color: theme.palette.primary.dark, - textAlign: 'center', + borderTop: '2px solid lightgrey', + borderRadius: 0, }, [`& .${classes.accordionSummary}`]: { fontWeight: 500, - fontSize: theme.spacing(1.75), - minHeight: theme.spacing(5), - '& > *': { - flexGrow: 0, - margin: 0, - color: theme.palette.primary.dark, - }, + minHeight: theme.spacing(8), }, [`& .${classes.menuItem}`]: { - whiteSpace: 'nowrap', - display: 'block', - color: theme.palette.primary.main, + justifyContent: 'start', + fontWeight: 300, + color: theme.palette.common.black, + }, + + '.Mui-expanded': { + backgroundColor: '#F0F0F0', }, })) @@ -52,22 +48,14 @@ export default function DonationMenuMobile() { className={classes.accordionSummary} expandIcon={} aria-controls="panel1a-content"> - {t('nav.donation-menu')} + {t('nav.campaigns.index')} - - {t('nav.campaigns.index')} - - {/* temporarily disabled */} - {/* - {t('nav.campaigns.create')} - */} - - {t('components.footer.terms-of-service')} - - - {t('nav.campaigns.faq')} - + {navItems.map(({ href, label }, key) => ( + + {t(label)} + + ))} ) diff --git a/src/components/layout/nav/MobileNav.tsx b/src/components/layout/nav/MobileNav.tsx index 988c83f71..d3e1f7ac7 100644 --- a/src/components/layout/nav/MobileNav.tsx +++ b/src/components/layout/nav/MobileNav.tsx @@ -1,101 +1,64 @@ -import { useRouter } from 'next/router' -import { styled } from '@mui/material/styles' import React, { useEffect } from 'react' +import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' -import { SwipeableDrawer, Hidden, Box, Grid, Button } from '@mui/material' - -import { isAdmin } from 'common/util/roles' -import { routes, staticUrls } from 'common/routes' -import LinkButton from 'components/common/LinkButton' +import { SwipeableDrawer, Hidden, Box, Grid, Theme } from '@mui/material' import PodkrepiIcon from 'components/brand/PodkrepiIcon' import CloseModalButton from 'components/common/CloseModalButton' - -import { navItems } from './ProjectMenu' import LocaleButton from '../LocaleButton' import DonationMenuMobile from './DonationMenuMobile' -import { useSession } from 'next-auth/react' - -const PREFIX = 'AuthLinks' - -const classes = { - navMenuDrawer: `${PREFIX}-navMenuDrawer`, - navMenuPaper: `${PREFIX}-navMenuPaper`, - icon: `${PREFIX}-icon`, - accordion: `${PREFIX}-accordion`, -} - -const Root = styled('nav')(({ theme }) => ({ - [`&.${classes.navMenuDrawer}`]: { - flexShrink: 0, - }, - - [`& .${classes.navMenuPaper}`]: { - width: parseFloat(theme.spacing(10)) * 4, - [theme.breakpoints.down('sm')]: { - width: '100%', - flexShrink: 0, - }, - }, - - [`& .${classes.icon}`]: { - fontSize: theme.typography.pxToRem(80), - marginTop: theme.spacing(5), - marginBottom: theme.spacing(5), - }, -})) +import ProjectMenuMobile from './ProjectMenuMobile' +import { createStyles, makeStyles } from '@mui/styles' +import { AuthLinks } from './AuthLinks' +import { routes } from 'common/routes' +import LinkButton from 'components/common/LinkButton' +import FavoriteIcon from '@mui/icons-material/Favorite' type NavDeckProps = { mobileOpen: boolean setMobileOpen: React.Dispatch> } -export const AuthLinks = () => { - const { data: session, status } = useSession() - const { t } = useTranslation() +const useStyles = makeStyles((theme: Theme) => + createStyles({ + localeButton: { + borderTop: '2px solid lightgrey', + display: 'flex', + minHeight: theme.spacing(8), - if (session) { - return ( - <> - - - {t('nav.profile')} - - - {status === 'authenticated' && isAdmin(session) && ( - - - - )} - - - {t('nav.logout')} - - - - ) - } - return ( - <> - - - {t('nav.login')} - - - - - {t('nav.register')} - - - - ) -} + '& button': { + justifyContent: 'start', + marginLeft: theme.spacing(1.3), + fontSize: theme.spacing(1.75), + }, + }, + closeModalButton: { + marginRight: theme.spacing(1.25), + }, + podkrepiLogoIcon: { + margin: '23px 0 12px 0', + }, + donateButtonWrapper: { + borderTop: '2px solid lightgrey', + textAlign: 'center', + minHeight: theme.spacing(8), + display: 'flex', + justifyContent: 'center', + paddingTop: theme.spacing(3), + }, + donateButton: { + padding: theme.spacing(1, 6), + }, + donateIcon: { + fontSize: '14px', + }, + }), +) export default function MobileNav({ mobileOpen, setMobileOpen }: NavDeckProps) { const router = useRouter() - const { t } = useTranslation() const closeNavMenu = () => setMobileOpen(false) + const classes = useStyles() + const { t } = useTranslation() // Register route change event handlers useEffect(() => { @@ -107,48 +70,51 @@ export default function MobileNav({ mobileOpen, setMobileOpen }: NavDeckProps) { }, []) return ( - - - setMobileOpen(true)} + + setMobileOpen(true)} + onClose={closeNavMenu}> + - - - - - - - + className={classes.closeModalButton} + /> + + + + + - {navItems.map(({ href, label }, key) => ( - - - {t(label)} - - - ))} - - - - - - - - - - - - - - - + + + + + + + + + + + + }> + {t('nav.donatŠµ')} + + + + + + ) } diff --git a/src/components/layout/nav/ProjectMenuMobile.tsx b/src/components/layout/nav/ProjectMenuMobile.tsx new file mode 100644 index 000000000..c18bc09e8 --- /dev/null +++ b/src/components/layout/nav/ProjectMenuMobile.tsx @@ -0,0 +1,62 @@ +import * as React from 'react' +import { styled } from '@mui/material/styles' +import Accordion from '@mui/material/Accordion' +import AccordionSummary from '@mui/material/AccordionSummary' +import AccordionDetails from '@mui/material/AccordionDetails' +import ExpandMoreIcon from '@mui/icons-material/ExpandMore' +import LinkButton from 'components/common/LinkButton' +import { useTranslation } from 'next-i18next' +import { navItems } from './ProjectMenu' + +const PREFIX = 'ProfileMenuMobile' + +const classes = { + accordionWrapper: `${PREFIX}-accordionWrapper`, + accordionSummary: `${PREFIX}-accordionSummary`, + menuItem: `${PREFIX}-menuItem`, +} + +const StyledAccordion = styled(Accordion)(({ theme }) => ({ + [`&.${classes.accordionWrapper}`]: { + boxShadow: 'none', + borderTop: '2px solid lightgrey', + borderRadius: 0, + }, + + [`& .${classes.accordionSummary}`]: { + fontWeight: 500, + minHeight: theme.spacing(8), + }, + + [`& .${classes.menuItem}`]: { + justifyContent: 'start', + fontWeight: 300, + color: theme.palette.common.black, + }, + + '.Mui-expanded': { + backgroundColor: '#F0F0F0', + }, +})) + +export default function ProjectMenuMobile() { + const { t } = useTranslation() + + return ( + + } + aria-controls="panel1a-content" + className={classes.accordionSummary}> + {t('nav.about.about-us')} + + + {navItems.map(({ href, label }, key) => ( + + {t(label)} + + ))} + + + ) +}