Skip to content

Commit ba6dc5c

Browse files
committed
Make more responsive
1 parent 1cc10df commit ba6dc5c

File tree

4 files changed

+43
-16
lines changed

4 files changed

+43
-16
lines changed

client/css/styles.scss

+27-11
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ html.fractal-root {
6565
}
6666

6767
.leaflet-control-zoom {
68-
margin-top: var(--space-12) !important;
69-
margin-left: var(--space-12) !important;
68+
margin-top: calc(env(safe-area-inset-top) + var(--space-12)) !important;
69+
margin-left: calc(env(safe-area-inset-left) + var(--space-12)) !important;
7070
}
7171

7272
.overlay {
@@ -88,8 +88,8 @@ html.fractal-root {
8888

8989
#navigation {
9090
min-width: unset;
91-
bottom: 0;
92-
left: 0;
91+
bottom: env(safe-area-inset-bottom);
92+
left: env(safe-area-inset-left);
9393
display: flex;
9494
align-items: center;
9595
gap: var(--space-12);
@@ -122,8 +122,8 @@ html.fractal-root {
122122
max-height: calc(100% - 52px);
123123
min-width: 256px;
124124
overflow-y: auto;
125-
top: 0;
126-
right: 0;
125+
top: env(safe-area-inset-top);
126+
right: env(safe-area-inset-right);
127127
display: flex;
128128
padding-top: 0;
129129
flex-direction: column;
@@ -281,8 +281,8 @@ button.underline-button {
281281

282282
#attribution {
283283
position: absolute;
284-
bottom: var(--space-8);
285-
right: var(--space-8);
284+
bottom: calc(env(safe-area-inset-bottom) + var(--space-8));
285+
right: calc(env(safe-area-inset-right) + var(--space-8));
286286
z-index: var(--z-index-modal);
287287
display: inline-block;
288288

@@ -388,8 +388,12 @@ input {
388388
}
389389
}
390390

391-
.nav-heading {
392-
font-size: var(--font-size-md);
391+
#navigation {
392+
padding-bottom: var(--space-8);
393+
394+
.nav-heading {
395+
font-size: var(--font-size-md);
396+
}
393397
}
394398

395399
.secondary {
@@ -479,7 +483,9 @@ input {
479483
nav {
480484
border-right: 1px solid var(--gray-500);
481485
background: color-mix(in sRGB, var(--gray-950) 25%, transparent);
482-
padding: var(--space-16) var(--space-24);
486+
padding-top: calc(env(safe-area-inset-top) + var(--space-16));
487+
padding-left: var(--space-24);
488+
padding-top: calc(env(safe-area-inset-bottom) + var(--space-16));
483489

484490
ul {
485491
list-style: none;
@@ -561,3 +567,13 @@ input {
561567
}
562568
}
563569
}
570+
571+
@media (min-width: 801px) {
572+
.blog-post-root {
573+
.blog-post {
574+
nav {
575+
height: 100vh;
576+
}
577+
}
578+
}
579+
}

client/html/blog-template.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@
5656
<link rel="manifest" href="site.webmanifest" />
5757

5858
<meta name="author" content="Ross Hill" />
59-
<meta name="viewport" content="width=device-width,minimum-scale=1" />
59+
<meta
60+
name="viewport"
61+
content="width=device-width,minimum-scale=1,viewport-fit=cover"
62+
/>
6063

6164
<link rel="stylesheet" href="/main.css" />
6265

client/html/index.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262
<link rel="manifest" href="site.webmanifest" />
6363

6464
<meta name="author" content="Ross Hill" />
65-
<meta name="viewport" content="width=device-width,minimum-scale=1" />
65+
<meta
66+
name="viewport"
67+
content="width=device-width,minimum-scale=1,viewport-fit=cover"
68+
/>
6669

6770
<script async defer src="https://buttons.github.io/buttons.js"></script>
6871
</head>

client/js/index.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import "./static";
22
import MandelbrotMap from "./MandelbrotMap";
33

4+
const mapHtmlId = "leaflet";
5+
const smallScreenWidthPx = 800;
6+
47
window.addEventListener("load", () => {
58
if ("serviceWorker" in navigator) {
69
navigator.serviceWorker
@@ -10,9 +13,11 @@ window.addEventListener("load", () => {
1013
});
1114
}
1215

13-
if (document.getElementById("leaflet")) {
16+
if (document.getElementById(mapHtmlId)) {
17+
const initialZoom = window.innerWidth <= smallScreenWidthPx ? 2 : 3;
18+
1419
new MandelbrotMap({
15-
htmlId: "leaflet",
20+
htmlId: mapHtmlId,
1621
initialConfig: {
1722
iterations: 200,
1823
exponent: 2,
@@ -27,7 +32,7 @@ window.addEventListener("load", () => {
2732

2833
re: -0.5,
2934
im: 0,
30-
zoom: 3,
35+
zoom: initialZoom,
3136
},
3237
});
3338
}

0 commit comments

Comments
 (0)