Skip to content

Commit 764f271

Browse files
committed
Fix header size for tablet edge case
1 parent c0002f3 commit 764f271

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

src/components/header/HomeLink.astro

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,20 @@ import Logo from "../Logo.astro";
4545
height: 40px;
4646
}
4747

48-
// For tablets and up
48+
// For tablets
4949
@media (min-width: $tabletMinWidth) {
50+
.site-title {
51+
font-size: 1.6rem;
52+
}
53+
54+
:global(.site-title-link > svg) {
55+
width: 50px;
56+
height: 50px;
57+
}
58+
}
59+
60+
// For laptops
61+
@media (min-width: $laptopMinWidth) {
5062
.site-title {
5163
font-size: xx-large;
5264
}

src/components/header/mobile/Menu.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import PageLink from "./PageLink.astro";
1313
<div id="theme-row" class="dropdown-item">
1414
<label for="theme">Theme:</label>
1515
<select name="theme" id="theme-select">
16-
{themes.map(({ name, theme }) => <option value={theme}>{name}</option>)}
16+
{themes.map(({ name, theme }) => <option value={theme ?? "Sync"}>{name}</option>)}
1717
</select>
1818
</div>
1919
</div>
@@ -43,7 +43,7 @@ import PageLink from "./PageLink.astro";
4343
document
4444
.getElementById("theme-select")!
4545
.addEventListener("change", (e: any) => {
46-
setTheme(e.currentTarget.value);
46+
setTheme(e.currentTarget.value === "Sync" ? null : e.currentTarget.value);
4747
});
4848
</script>
4949

src/components/header/tablet/Menu.astro

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const { title, isBlogPost } = Astro.props;
2020

2121
<div id="laptop-header" class="header">
2222
<nav class="menu">
23-
{PAGES.map((page) => <MenuItem curr={title} isBlogPost={isBlogPost} {...page} />)}
23+
{
24+
PAGES.map((page) => (
25+
<MenuItem curr={title} isBlogPost={isBlogPost} {...page} />
26+
))
27+
}
2428
</nav>
2529
<div class="text-start social-media-icons">
2630
{
@@ -39,23 +43,29 @@ const { title, isBlogPost } = Astro.props;
3943
@import "../../../styles/common.scss";
4044

4145
#laptop-header {
42-
display: flex;
46+
display: none;
47+
48+
@media (min-width: $tabletMinWidth) {
49+
display: flex;
50+
}
51+
}
52+
53+
#laptop-header {
4354
margin-left: auto;
4455
flex-direction: row;
4556
align-items: center;
4657
gap: 1.7rem;
4758
}
4859

49-
@media (max-width: ($tabletMinWidth - 1)) {
50-
#laptop-header {
51-
display: none;
52-
}
53-
}
54-
5560
.menu {
5661
display: inline-flex;
5762
margin-left: auto;
58-
gap: 1rem;
63+
64+
gap: 1.5ch;
65+
66+
@media (min-width: $laptopMinWidth) {
67+
gap: 2ch;
68+
}
5969
}
6070

6171
.social-media-icons {

src/layouts/BaseLayout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ if (!title && frontmatter && "title" in frontmatter) {
5252
}
5353

5454
body > header {
55-
// Padding for very small screens (phones in portrait orientation)
55+
// Less padding for phones and tablets
5656
padding-left: 5vw;
5757
padding-right: 5vw;
5858

5959
@media (min-width: $laptopMinWidth) {
60-
padding-left: 4vw;
61-
padding-right: 4vw;
60+
padding-left: 8vw;
61+
padding-right: 8vw;
6262
}
6363
}
6464

0 commit comments

Comments
 (0)