Skip to content
Snippets Groups Projects
Verified Commit 5cca3ccb authored by Andreas Ellewsen's avatar Andreas Ellewsen
Browse files

Use Typography for more frontend text elements

parent ef2c01b4
No related branches found
No related tags found
1 merge request!256Greg 172 Normalise frontend font sizes
Pipeline #112113 passed
...@@ -27,6 +27,7 @@ function LanguageSelector({ noPadding }: { noPadding: boolean }) { ...@@ -27,6 +27,7 @@ function LanguageSelector({ noPadding }: { noPadding: boolean }) {
'& .MuiSelect-icon': { '& .MuiSelect-icon': {
color: 'white', color: 'white',
}, },
fontSize: '1.25rem',
} }
if (noPadding) { if (noPadding) {
......
...@@ -5,11 +5,7 @@ import Box from '@mui/material/Box' ...@@ -5,11 +5,7 @@ import Box from '@mui/material/Box'
import AccountBoxOutlinedIcon from '@mui/icons-material/AccountBoxOutlined' import AccountBoxOutlinedIcon from '@mui/icons-material/AccountBoxOutlined'
import { HrefButton } from 'components/button' import { HrefButton } from 'components/button'
import { Button } from '@mui/material' import { Button, Typography } from '@mui/material'
const StyledParagraph = styled('p')({
fontSize: '1rem',
})
const StyledBox = styled(Box)({ const StyledBox = styled(Box)({
borderStyle: 'solid', borderStyle: 'solid',
...@@ -50,16 +46,18 @@ const LoginBox = ({ ...@@ -50,16 +46,18 @@ const LoginBox = ({
height: '35%', height: '35%',
}} }}
> >
<Box sx={{ display: 'flex', alignItems: 'center' }}> <Box sx={{ display: 'flex', alignItems: 'center', paddingBottom: 1 }}>
<AccountBoxOutlinedIcon <AccountBoxOutlinedIcon
fontSize="inherit" fontSize="inherit"
sx={{ sx={{
marginRight: { xs: '0rem', md: '0.5rem' }, marginRight: { xs: '0rem', md: '0.5rem' },
}} }}
/> />
{header} <Typography variant="h3" component="h2">
{header}
</Typography>
</Box> </Box>
<StyledParagraph>{info}</StyledParagraph> <Typography variant="body2">{info}</Typography>
</Box> </Box>
<Box <Box
sx={{ sx={{
......
...@@ -2,17 +2,9 @@ import React from 'react' ...@@ -2,17 +2,9 @@ import React from 'react'
import { Helmet } from 'react-helmet' import { Helmet } from 'react-helmet'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { styled } from '@mui/material/styles' import { Container, Typography } from '@mui/material'
import { Container } from '@mui/material'
import { appInst } from 'appConfig' import { appInst } from 'appConfig'
const StyledPageHeader = styled('h1')(({ theme }) => ({
color: theme.greg.textWhite,
fontSize: '3rem',
fontWeight: 'bold',
margin: '1rem 0 1rem 0',
}))
interface IPage { interface IPage {
children: React.ReactNode children: React.ReactNode
header?: string header?: string
...@@ -47,7 +39,7 @@ export default function Page(props: IPage) { ...@@ -47,7 +39,7 @@ export default function Page(props: IPage) {
maxWidth="md" maxWidth="md"
sx={{ paddingBottom: '2rem', paddingTop: '2rem' }} sx={{ paddingBottom: '2rem', paddingTop: '2rem' }}
> >
{header ? <StyledPageHeader>{header}</StyledPageHeader> : <></>} {header ? <Typography variant="h1">{header}</Typography> : <></>}
{children} {children}
</Container> </Container>
</> </>
......
...@@ -27,7 +27,7 @@ const InfoSection = styled('div')(({ theme }) => ({ ...@@ -27,7 +27,7 @@ const InfoSection = styled('div')(({ theme }) => ({
})) }))
const FooterHeader = styled('div')({ const FooterHeader = styled('div')({
fontSize: '2rem', fontSize: '1.9375rem',
color: 'white', color: 'white',
padding: '1rem 0 2rem 0', padding: '1rem 0 2rem 0',
}) })
...@@ -45,7 +45,7 @@ const LinkSection = styled('div')({ ...@@ -45,7 +45,7 @@ const LinkSection = styled('div')({
}) })
const LinkHeader = styled('div')({ const LinkHeader = styled('div')({
fontSize: '0.8rem', fontSize: '0.75rem',
marginBottom: '0.5rem', marginBottom: '0.5rem',
}) })
...@@ -60,6 +60,7 @@ const LogoSection = styled('div')(({ theme }) => ({ ...@@ -60,6 +60,7 @@ const LogoSection = styled('div')(({ theme }) => ({
const StyledLink = styled(Link)({ const StyledLink = styled(Link)({
color: 'white', color: 'white',
fontSize: '1.0625rem',
}) })
StyledLink.defaultProps = { StyledLink.defaultProps = {
......
...@@ -63,6 +63,7 @@ const Header = () => { ...@@ -63,6 +63,7 @@ const Header = () => {
<Link <Link
sx={{ sx={{
color: 'white', color: 'white',
fontSize: '1.25rem',
}} }}
href={logoutLink} href={logoutLink}
> >
......
...@@ -4,7 +4,7 @@ import { Typography } from '@mui/material' ...@@ -4,7 +4,7 @@ import { Typography } from '@mui/material'
export default function NotFound() { export default function NotFound() {
return ( return (
<Page header="404 - Not found"> <Page>
<Typography variant="h1">404 - Not found</Typography> <Typography variant="h1">404 - Not found</Typography>
</Page> </Page>
) )
......
import { Box } from '@mui/material' import { Box, Typography } from '@mui/material'
import { useUserContext } from 'contexts' import { useUserContext } from 'contexts'
...@@ -8,7 +8,9 @@ function UserInfo() { ...@@ -8,7 +8,9 @@ function UserInfo() {
if (user.auth) { if (user.auth) {
return ( return (
<Box sx={{ paddingLeft: '0.5rem' }}> <Box sx={{ paddingLeft: '0.5rem' }}>
{user.first_name} {user.last_name} <Typography sx={{ fontSize: '1.25rem' }}>
{user.first_name} {user.last_name}
</Typography>
</Box> </Box>
) )
} }
......
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { styled } from '@mui/system'
import { Container, Typography } from '@mui/material' import { Container, Typography } from '@mui/material'
import LoginBox from 'components/loginBox' import LoginBox from 'components/loginBox'
import { instNameUpperCaser } from 'utils' import { instNameUpperCaser } from 'utils'
import { appInst } from 'appConfig' import { appInst } from 'appConfig'
const StyledParagraph = styled('p')({
fontSize: '1rem',
})
export default function LoginPage() { export default function LoginPage() {
const { t } = useTranslation(['frontpage']) const { t } = useTranslation(['frontpage'])
...@@ -24,10 +19,12 @@ export default function LoginPage() { ...@@ -24,10 +19,12 @@ export default function LoginPage() {
}} }}
> >
<Container> <Container>
<Typography variant="h1">{t('header')}</Typography> <Typography variant="h1" sx={{ paddingBottom: '1rem' }}>
<StyledParagraph sx={{ marginBottom: '4rem' }}> {t('header')}
</Typography>
<Typography variant="body1" sx={{ paddingBottom: '2rem' }}>
{t('description', { inst: instNameUpperCaser(appInst) })} {t('description', { inst: instNameUpperCaser(appInst) })}
</StyledParagraph> </Typography>
</Container> </Container>
<Container <Container
......
...@@ -6,7 +6,7 @@ import Loading from 'components/loading' ...@@ -6,7 +6,7 @@ import Loading from 'components/loading'
import { useUserContext } from 'contexts' import { useUserContext } from 'contexts'
import { setCookie, submitJsonOpts } from 'utils' import { setCookie, submitJsonOpts } from 'utils'
import LoginBox from 'components/loginBox' import LoginBox from 'components/loginBox'
import { Box, Container, Typography } from '@mui/material' import { Container, Typography } from '@mui/material'
function ChooseRegistrationMethod() { function ChooseRegistrationMethod() {
const { t } = useTranslation(['invite']) const { t } = useTranslation(['invite'])
...@@ -28,10 +28,12 @@ function ChooseRegistrationMethod() { ...@@ -28,10 +28,12 @@ function ChooseRegistrationMethod() {
marginBottom: '8rem', marginBottom: '8rem',
}} }}
> >
<Typography variant="h1">{t('header')}</Typography> <Typography variant="h1" sx={{ marginBottom: '2rem' }}>
<Box sx={{ fontSize: '1rem', marginBottom: '2rem' }}> {t('header')}
</Typography>
<Typography variant="body1" sx={{ marginBottom: '2rem' }}>
{t('description')} {t('description')}
</Box> </Typography>
<LoginBox <LoginBox
header={t('guest')} header={t('guest')}
info={t('guestInfo')} info={t('guestInfo')}
......
...@@ -12,17 +12,23 @@ const mainTheme: ThemeOptions = { ...@@ -12,17 +12,23 @@ const mainTheme: ThemeOptions = {
}, },
typography: { typography: {
fontSize: 16, fontSize: 16,
h1: {
fontSize: '2.75rem', // 44px
},
h2: { h2: {
fontSize: '1.75rem', //28px at font-size 16 fontSize: '1.75rem', // 28px
}, },
h3: { h3: {
fontSize: '1.375rem', //22px fontSize: '1.375rem', // 22px
}, },
body1: { body1: {
fontSize: '1.125rem', //18px fontSize: '1.125rem', // 18px
},
body2: {
lineHeight: 1.5,
}, },
button: { button: {
fontSize: '0.875rem', //14px fontSize: '0.875rem', // 14px
}, },
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment