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

Mobile layout tweaks #104

Merged
merged 7 commits into from
Jul 2, 2024
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
3 changes: 2 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const __dirname = path.dirname(__filename);
/** @type {import('next').NextConfig} */
export default {
sassOptions: {
includePaths: [path.join(__dirname, 'styles')]
includePaths: [path.join(__dirname, 'styles')],
prependData: `@import "@/styles/variables.scss";`
},
output: 'standalone',
experimental: {
Expand Down
7 changes: 4 additions & 3 deletions src/components/Banner/Banner.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
text-align: center;
color: white;
z-index: 1;
width: 100%;
}

.title h1 {
Expand All @@ -49,7 +50,7 @@
margin-bottom: -0.25rem;
}

@media screen and (max-width: 1024px) {
@media screen and (max-width: #{$mobile-layout-breakpoint}) {
.banner,
.banner img {
height: calc(6rem + 20vw);
Expand All @@ -61,10 +62,10 @@
}

.title h1 {
font-size: 2rem;
font-size: min(calc(0.25rem + 6vw), 3rem);
}

.title h2 {
font-size: 1rem;
font-size: min(calc(0.125rem + 3vw), 1.5rem);
}
}
1 change: 1 addition & 0 deletions src/components/Calendar/CalendarTiles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
border-radius: 0.375rem;
border: solid 0.125rem var(--content-background-color);
aspect-ratio: 1 / 1;
min-width: 0;
overflow: visible !important;
position: relative;
}
Expand Down
17 changes: 15 additions & 2 deletions src/components/Header/EscapeHatch/EscapeHatch.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,21 @@
color: var(--text-color);
}

@media (max-width: 768px) {
@media (max-width: #{$header-breakpoint}) {
.escapeHatch {
padding-left: 1.25rem;
padding-left: min(calc(0.25rem + 2vw), 1.25rem);
}

.itlogo {
height: min(calc(8vw + 1rem), 3.125rem);
width: min(calc(8vw + 1rem), 3.125rem);
}

.title {
font-size: min(4.5vw, 1.5rem);
}

.subtitle {
font-size: min(3vw, 1rem);
}
}
2 changes: 1 addition & 1 deletion src/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
display: none;
}

@media screen and (max-width: 768px) {
@media screen and (max-width: #{$header-breakpoint}) {
.desktop {
display: none;
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Header/NavDrawer/NavDrawer.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
padding: 0.2rem;
margin-left: 1rem;
color: var(--text-color);
line-height: 1.2rem;
height: min(calc(1.5rem + 2.5vw), 2.5rem);
width: min(calc(1.5rem + 2.5vw), 2.5rem);
}

.drawer {
Expand All @@ -14,6 +15,7 @@
left: 0;
width: 100vw;
height: 100vh;
height: 100dvh;
}

.content > * {
Expand Down
33 changes: 25 additions & 8 deletions src/components/Header/Navigation/Dropdown/Dropdown.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,49 @@
}

.dropdownContent {
display: none;
position: absolute;
position: relative;
min-width: 10rem;
max-width: 15rem;
z-index: 3;
}

@media (hover: hover) {
.dropdownContainer {
position: absolute;
}

@media (hover: hover) and (not (max-width: #{$header-breakpoint})) {
.dropdownContent {
display: none;
}
.dropdown:hover .dropdownContent,
.dropdown:hover .dropdownHitbox {
display: block;
}
}

@media (hover: none) {
.dropdownInput:checked + .dropdownLabel + .dropdownHitbox + .dropdownContent {
display: block;
@media (hover: none) or (max-width: #{$header-breakpoint}) {
.dropdownContainer {
display: grid;
grid-template-rows: 0fr;
}
.dropdownContent {
overflow-y: hidden;
}
.dropdownInput:checked
+ .dropdownLabel
+ .dropdownHitbox
+ .dropdownContainer {
grid-template-rows: 1fr;
}
.dropdownHitbox {
display: none;
}
}

@media (max-width: 768px) {
.dropdownContent {
@media (max-width: #{$header-breakpoint}) {
.dropdownContainer {
position: relative;
transition: grid-template-rows 0.5s;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/Header/Navigation/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const Dropdown = ({
<label htmlFor={id} className={styles.dropdownLabel}>
{parent}
</label>
<div className={styles.dropdownHitbox} />
<div className={`${styles.dropdownHitbox}`} />

<div
className={`${styles.dropdownContent} ${playfair.className} ${contentClassName}`}
>
{children}
<div className={`${styles.dropdownContainer} ${contentClassName}`}>
<div className={`${styles.dropdownContent} ${playfair.className}`}>
{children}
</div>
</div>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions src/components/Header/Navigation/Navigation.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
margin: 0 1rem;
}

.navMobile {
flex-direction: column !important;
align-items: start;
justify-content: left;
}

.navLink {
font-size: 16px;
color: var(--text-color);
Expand Down
3 changes: 2 additions & 1 deletion src/components/Header/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ type Props = {
const Navigation = ({ locale, desktop }: Props) => {
const l = i18nService.getLocale(locale);
const c = desktop ? styles.desktopDropdown : undefined;
const navStyle = desktop ? styles.nav : `${styles.nav} ${styles.navMobile}`;

return (
<nav className={styles.nav}>
<nav className={navStyle}>
<DropdownLink
contentClassName={c}
text={l.nav.division}
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewsList/InfiniteScroller.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
display: none;
}

@media (max-width: 768px) {
@media (max-width: #{$mobile-layout-breakpoint}) {
.loadButton {
display: block;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ThreePaneLayout/ThreePaneLayout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
flex: 3 0 0;
}

@media (max-width: 1024px) {
@media (max-width: #{$mobile-layout-breakpoint}) {
.main {
flex-direction: column;
padding: 1rem;
Expand Down
2 changes: 2 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$header-breakpoint: 1200px;
$mobile-layout-breakpoint: 1024px;
Loading