Skip to content

Commit 69fc695

Browse files
authored
Merge pull request #1215 from processing/1185-2
fix: prevent hero heading overlap on mobile and tablet viewports (#1061)
2 parents ad8c4f2 + b424d11 commit 69fc695

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/components/PageHeader/HomePage.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { config } = Astro.props;
1010
1111
---
1212

13-
<div class="px-lg pt-[11.25rem] lg:pt-3xl pb-0 h-full">
13+
<div class="max-lg:flex max-lg:flex-col px-lg pt-[11.25rem] lg:pt-3xl pb-0 h-full">
1414
<div class="homepage-header-top">
1515
<div class="grid grid-cols-3 lg:grid-cols-4 gap-md overflow-visible h-min">
1616
<p class="col-span-2 lg:col-span-3 mt-0 text-md md:text-xl lg:text-3xl">
@@ -39,7 +39,7 @@ const { config } = Astro.props;
3939
{
4040
config.data.heroImages.map((im, i) => (
4141
im.linkTarget ?
42-
<a href={im.linkTarget} class={`hero-image-container ${i > 0 ? "hidden" : ""}`}>
42+
<a href={im.linkTarget} class={`max-lg:flex-1 max-lg:min-h-0 hero-image-container ${i > 0 ? "hidden" : ""}`}>
4343
<Image
4444
containerClass={"relative"}
4545
class={"hero-image"}
@@ -51,7 +51,7 @@ const { config } = Astro.props;
5151
</a>
5252
:
5353
<Image
54-
containerClass={`relative hero-image-container ${i > 0 ? "hidden" : ""}`}
54+
containerClass={`max-lg:flex-1 max-lg:min-h-0 relative hero-image-container ${i > 0 ? "hidden" : ""}`}
5555
class={"hero-image"}
5656
aspectRatio="none"
5757
src={im.image}

styles/global.scss

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ code {
207207
background-color: var(--bg-gray-80);
208208
border-radius: 20px;
209209
padding: 0 var(--spacing-xxs);
210+
210211
.dark-theme &:not(.code-box) {
211212
color: var(--type-black);
212213
}
@@ -237,9 +238,11 @@ section,
237238
.text-h2,
238239
h3,
239240
text-h3 {
241+
240242
&,
241-
& > * {
243+
&>* {
242244
scroll-margin-top: var(--gutter-md);
245+
243246
@media (min-width: $breakpoint-tablet) {
244247
scroll-margin-top: var(--gutter-sm);
245248
}
@@ -269,6 +272,7 @@ section,
269272
overflow-x: auto;
270273

271274
border-radius: 20px;
275+
272276
@media (max-width: $breakpoint-tablet) {
273277
border-radius: 10px;
274278
}
@@ -469,6 +473,16 @@ th {
469473
border-color: var(--type-color);
470474
border-bottom-width: 1px;
471475
border-top-width: 1px;
476+
477+
// Fix #1061: On mobile/tablet (< 1024px) the outer wrapper is a flex column
478+
// and the image container is flex-1. height: 100% fills the remaining header
479+
// space exactly — no overflow into the h1 below, no gap on tall devices.
480+
@media (max-width: #{$breakpoint-laptop - 1px}) {
481+
height: 100%;
482+
max-height: none;
483+
min-height: 180px;
484+
}
485+
472486
@media (min-width: $breakpoint-tablet) {
473487
left: calc(-1 * var(--spacing-lg));
474488
width: calc(100% + var(--spacing-lg) * 2);
@@ -482,6 +496,7 @@ hr.full-bleed {
482496
left: -2.5rem;
483497
width: calc(100% + 5rem);
484498
max-width: calc(100% + 5rem);
499+
485500
@media (min-width: $breakpoint-tablet) {
486501
left: calc(-1 * var(--spacing-lg));
487502
width: calc(100% + var(--spacing-lg) * 2);
@@ -501,10 +516,13 @@ input[type="search"]::-webkit-search-results-decoration {
501516
.no-scrollbar::-webkit-scrollbar {
502517
display: none;
503518
}
519+
504520
/* Hide scrollbar for IE, Edge and Firefox */
505521
.no-scrollbar {
506-
-ms-overflow-style: none; /* IE and Edge */
507-
scrollbar-width: none; /* Firefox */
522+
-ms-overflow-style: none;
523+
/* IE and Edge */
524+
scrollbar-width: none;
525+
/* Firefox */
508526
}
509527

510528
/** SPECIAL ELEMENTS **/
@@ -550,4 +568,4 @@ body {
550568

551569
.dark-theme pre.mermaid svg {
552570
filter: invert(100%);
553-
}
571+
}

0 commit comments

Comments
 (0)