Skip to content

Commit 828caf1

Browse files
authored
Upravit TopGrid komponentu podla designu (#212)
* Use typography variants in TopGrid * Refactor and improve TopGrid
1 parent 14f9da2 commit 828caf1

File tree

8 files changed

+45
-39
lines changed

8 files changed

+45
-39
lines changed

src/components/PageLayout/Banner/Banner.module.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
.banner{
2-
position: fixed;
32
width: 100vw;
4-
top: 10rem;
5-
left: 0;
63
height: 2rem;
74
background-color: black;
85
color: white;
96
border: none;
107
display: flex;
118
align-items: center;
129
padding: 0px;
13-
z-index: 2;
10+
z-index: 3;
11+
margin-bottom: 0.5rem;
1412
}
1513

1614

src/components/PageLayout/PageLayout.module.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
.grid {
66
display: grid;
77
grid-template-columns: repeat(4, 1fr);
8-
// top offset because of sticky menu/title/banner
9-
padding-top: 12rem;
108
// bottom offset because of sticky debug footer
119
padding-bottom: 1rem;
1210
}

src/components/PageLayout/PageLayout.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {FC, ReactNode} from 'react'
44
import {BannerContainer} from '@/utils/BannerContainer'
55
import {PageTitleContainer} from '@/utils/PageTitleContainer'
66

7-
import {Banner} from './Banner/Banner'
87
import {Footer} from './Footer/Footer'
98
import {MenuMain} from './MenuMain/MenuMain'
109
import styles from './PageLayout.module.scss'
@@ -25,7 +24,6 @@ export const PageLayout: FC<PageLayoutProps> = ({contentWidth = 2, title = '', c
2524
<BannerContainer.Provider>
2625
<div className={styles.pageContainer}>
2726
<TopGrid />
28-
<Banner />
2927
<MenuMain />
3028
<div className={styles.grid}>
3129
<StromLogo />

src/components/PageLayout/TopGrid/TopGrid.module.scss

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
.container {
2-
position: fixed;
2+
position: sticky;
33
top: 0;
44
left: 0;
55
right: 0;
6-
height: 10rem;
6+
height: auto;
77
background-color: white;
88
z-index: 3;
9+
}
10+
11+
.grid {
912
display: grid;
10-
grid-template: 1fr 1fr / 1fr 2fr 1fr;
13+
grid-template: 1fr auto / 1fr 2fr 1fr;
1114
}
1215

1316
.menu {
@@ -22,13 +25,9 @@
2225
// second row center column
2326
grid-row: 2;
2427
grid-column: 2;
25-
font-size: 1.7rem;
26-
font-weight: bold;
2728
padding-left: 20px;
2829
display: flex;
2930
align-items: center;
30-
text-transform: uppercase;
31-
font-style: italic;
3231
}
3332

3433
.semesterPicker {
@@ -40,8 +39,6 @@
4039
}
4140

4241
.menuItem {
43-
font-size: 1.3rem;
44-
font-weight: bold;
4542
padding: 8px;
4643
margin: 10px;
4744
}

src/components/PageLayout/TopGrid/TopGrid.module.scss.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export type Styles = {
22
active: string
33
container: string
4+
grid: string
45
menu: string
56
menuItem: string
67
semesterPicker: string
Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Stack, Typography} from '@mui/material'
12
import clsx from 'clsx'
23
import Link from 'next/link'
34
import {useRouter} from 'next/router'
@@ -7,6 +8,7 @@ import {SemesterPicker} from '@/components/SemesterPicker/SemesterPicker'
78
import {PageTitleContainer} from '@/utils/PageTitleContainer'
89
import {useSeminarInfo} from '@/utils/useSeminarInfo'
910

11+
import {Banner} from '../Banner/Banner'
1012
import styles from './TopGrid.module.scss'
1113

1214
export const TopGrid: FC = () => {
@@ -18,24 +20,35 @@ export const TopGrid: FC = () => {
1820
const {pageTitle} = PageTitleContainer.useContainer()
1921

2022
return (
21-
<div className={styles.container}>
22-
<div className={styles.menu}>
23-
<div className={clsx(styles.menuItem, seminar === 'malynar' && styles.active)}>
24-
<Link href="/malynar">Malynár</Link>
25-
</div>
26-
<div className={clsx(styles.menuItem, seminar === 'matik' && styles.active)}>
27-
<Link href="/matik">Matik</Link>
28-
</div>
29-
<div className={clsx(styles.menuItem, seminar === 'strom' && styles.active)}>
30-
<Link href="/strom">Strom</Link>
23+
<Stack className={styles.container}>
24+
<div className={styles.grid}>
25+
<div className={styles.menu}>
26+
<div className={clsx(styles.menuItem, seminar === 'malynar' && styles.active)}>
27+
<Typography variant="button1">
28+
<Link href="/malynar">Malynár</Link>
29+
</Typography>
30+
</div>
31+
<div className={clsx(styles.menuItem, seminar === 'matik' && styles.active)}>
32+
<Typography variant="button1">
33+
<Link href="/matik">Matik</Link>
34+
</Typography>
35+
</div>
36+
<div className={clsx(styles.menuItem, seminar === 'strom' && styles.active)}>
37+
<Typography variant="button1">
38+
<Link href="/strom">Strom</Link>
39+
</Typography>
40+
</div>
3141
</div>
42+
<Typography variant="h1" className={styles.title}>
43+
{pageTitle}
44+
</Typography>
45+
{(page === 'zadania' || page === 'vysledky') && (
46+
<div className={styles.semesterPicker}>
47+
<SemesterPicker page={page} />
48+
</div>
49+
)}
3250
</div>
33-
<div className={styles.title}>{pageTitle}</div>
34-
{(page === 'zadania' || page === 'vysledky') && (
35-
<div className={styles.semesterPicker}>
36-
<SemesterPicker page={page} />
37-
</div>
38-
)}
39-
</div>
51+
<Banner />
52+
</Stack>
4053
)
4154
}

src/components/SemesterPicker/Dropdown.module.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
width: fit-content;
44
display: flex;
55
align-items: center;
6-
text-transform: uppercase;
7-
font-weight: bold;
8-
font-style: italic;
96
position: relative;
107
margin: 0px 20px;
118

src/components/SemesterPicker/Dropdown.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Typography} from '@mui/material'
12
import clsx from 'clsx'
23
import Link from 'next/link'
34
import {FC, MouseEvent, useState} from 'react'
@@ -25,7 +26,10 @@ export const Dropdown: FC<{title: string; options: DropdownOption[]}> = ({title,
2526

2627
return (
2728
<div className={styles.dropdown} onClick={handleClick} onMouseLeave={handleMouseLeave}>
28-
{title} <div className={styles.arrow} />
29+
<Typography variant="button2">
30+
{title}
31+
<div className={styles.arrow} />
32+
</Typography>
2933
<div className={clsx(styles.options, display && styles.displayOptions)}>
3034
{options.map((option) => {
3135
return (
@@ -34,7 +38,7 @@ export const Dropdown: FC<{title: string; options: DropdownOption[]}> = ({title,
3438
key={option.id}
3539
className={clsx(styles.option, option.selected && styles.selectedOption)}
3640
>
37-
{option.text}
41+
<Typography variant="button2">{option.text}</Typography>
3842
</Link>
3943
)
4044
})}

0 commit comments

Comments
 (0)