Skip to content

Commit

Permalink
387 - Mobil - buttony seminarov (#441)
Browse files Browse the repository at this point in the history
* unrelated: fix wrap of SemesterPicker on resolution somewhere between 900-940

* add seminar buttons - variant 1

* add seminar buttons - variant 2

* fix menu close button position - right side on mobile

* fix menu button shrinking

* fix menu button shrinking + make SeminarButtons wrap

* SemesterPicker - align right also on wrap
  • Loading branch information
rtrembecky authored Nov 22, 2024
1 parent 6948155 commit 4bb9454
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 36 deletions.
6 changes: 5 additions & 1 deletion src/components/PageLayout/MenuMain/MenuMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ export const MenuMain: FC = () => {
}}
>
<Box flexGrow={1}>
<CloseButton size={iconSize} onClick={toggleMenu} sx={{position: 'absolute', top: 24, left: 24}} />
<CloseButton
size={iconSize}
onClick={toggleMenu}
sx={{position: 'absolute', top: 24, left: {xs: undefined, md: 24}, right: {xs: 24, md: undefined}}}
/>
{menuItemsIsLoading && (
<Box sx={{position: 'absolute', top: '50%', left: 0, right: 0, color: 'white'}}>
<Loading />
Expand Down
75 changes: 44 additions & 31 deletions src/components/PageLayout/TopGrid/TopGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ import {useSeminarInfo} from '@/utils/useSeminarInfo'
import {Banner} from '../Banner/Banner'
import {MenuMain} from '../MenuMain/MenuMain'

type SeminarButtonsProps = {
seminar: string
}
const SeminarButtons: FC<SeminarButtonsProps> = ({seminar}) => {
return (
<Stack sx={{flexDirection: 'row', gap: 1, justifyContent: 'end', flexWrap: 'wrap'}}>
<Link
href="/malynar"
variant="seminarButton"
sx={seminar === 'malynar' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Malynár
</Link>
<Link
variant="seminarButton"
href="/matik"
sx={seminar === 'matik' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Matik
</Link>
<Link
variant="seminarButton"
href="/strom"
sx={seminar === 'strom' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Strom
</Link>
</Stack>
)
}

export const TopGrid: FC = () => {
const {seminar} = useSeminarInfo()

Expand All @@ -33,48 +64,30 @@ export const TopGrid: FC = () => {
<Stack sx={{position: 'sticky', top: 0, width: '100%', backgroundColor: 'white', zIndex: 3}}>
<Grid container disableEqualOverflow spacing={1} p={3}>
{/* first row */}
<Grid xs={12} md={3}>
<Stack sx={{alignItems: {xs: 'end', md: 'start'}}}>
<Grid xs={0} md={3} sx={{display: {xs: 'none', md: 'block'}}}>
<Stack sx={{alignItems: 'start'}}>
<MenuMain />
</Stack>
</Grid>
<Grid xs={0} md={6} sx={{display: {xs: 'none', md: 'block'}}} />
<Grid xs={0} md={3} sx={{display: {xs: 'none', md: 'block'}}}>
<Stack sx={{flexDirection: 'row', spacing: 2, justifyContent: 'flex-end'}}>
<Link
href="/malynar"
variant="button1"
sx={seminar === 'malynar' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Malynár
</Link>
<Link
variant="button1"
href="/matik"
sx={seminar === 'matik' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Matik
</Link>
<Link
variant="button1"
href="/strom"
sx={seminar === 'strom' ? {color: 'white', backgroundColor: 'black'} : {}}
>
Strom
</Link>
<Grid xs={0} md={9} sx={{display: {xs: 'none', md: 'block'}}}>
<SeminarButtons seminar={seminar} />
</Grid>
<Grid xs={12} md={0} sx={{display: {xs: 'block', md: 'none'}}}>
<Stack sx={{flexDirection: 'row', gap: 2, justifyContent: 'end'}}>
<SeminarButtons seminar={seminar} />
<Stack sx={{flexShrink: 0}}>
<MenuMain />
</Stack>
</Stack>
</Grid>

{/* second row */}
<Grid xs={0} md={3} sx={{display: {xs: 'none', md: 'block'}}} />
<Grid xs={12} md={6}>
<Grid xs={12} md={6} mdOffset={3}>
<Typography variant="h1">{pageTitle}</Typography>
</Grid>
{semesterPickerPage && (
<Grid xs={12} md={3}>
<Stack sx={{alignItems: 'flex-end'}}>
<SemesterPicker page={semesterPickerPage} />
</Stack>
<SemesterPicker page={semesterPickerPage} />
</Grid>
)}
</Grid>
Expand Down
9 changes: 5 additions & 4 deletions src/components/SemesterPicker/SemesterPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ export const SemesterPicker: FC<{page: 'zadania' | 'vysledky' | 'admin/opravovan
sx={{
flexDirection: 'row',
alignItems: 'center',
columnGap: 2,
// wrap na nizsich rozliseniach
flexWrap: 'wrap',
rowGap: 1,
// wrap na velmi nizkych rozliseniach
flexWrap: 'wrap-reverse',
rowGap: 0.5,
zIndex: 1000,
userSelect: 'none',
// pre pouzitie v TopGrid + pri wrapnuti
justifyContent: 'end',
}}
>
{page !== 'admin/opravovanie' && <Dropdown title={'Séria'} options={dropdownSeriesList} />}
Expand Down
20 changes: 20 additions & 0 deletions src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ declare module '@mui/material/styles' {
button1: React.CSSProperties
button2: React.CSSProperties
button3: React.CSSProperties
seminarButton: React.CSSProperties
postTitle: React.CSSProperties
postBody: React.CSSProperties
postDate: React.CSSProperties
Expand All @@ -19,6 +20,7 @@ declare module '@mui/material/styles' {
button1?: React.CSSProperties
button2?: React.CSSProperties
button3?: React.CSSProperties
seminarButton?: React.CSSProperties
postTitle?: React.CSSProperties
postBody?: React.CSSProperties
postDate?: React.CSSProperties
Expand All @@ -32,6 +34,7 @@ declare module '@mui/material/Typography' {
button1: true
button2: true
button3: true
seminarButton: true
postTitle: true
postBody: true
postDate: true
Expand Down Expand Up @@ -124,6 +127,12 @@ const _theme = createTheme({
fontWeight: 800,
fontStyle: 'italic',
},
seminarButton: {
...font.style,
textTransform: 'uppercase',
fontWeight: 800,
fontStyle: 'italic',
},
postTitle: {
...font.style,
fontWeight: 800,
Expand All @@ -148,6 +157,7 @@ const _theme = createTheme({
button1: 'span',
button2: 'span',
button3: 'span',
seminarButton: 'span',
postTitle: 'h1',
postBody: 'span',
postDate: 'span',
Expand Down Expand Up @@ -285,6 +295,16 @@ export const theme: Theme = {
[xl]: {fontSize: pxToRem(14)},
lineHeight: 1.5,
},
seminarButton: {
..._theme.typography.seminarButton,
// original Figma fontSize: 30px, mobile non-existent
fontSize: pxToRem(14),
[sm]: {fontSize: pxToRem(16)},
[md]: {fontSize: pxToRem(18)},
[lg]: {fontSize: pxToRem(22)},
[xl]: {fontSize: pxToRem(30)},
lineHeight: 1.5,
},
postTitle: {
..._theme.typography.postTitle,
// original Figma fontSize: 36px
Expand Down

0 comments on commit 4bb9454

Please sign in to comment.