Skip to content

Commit 964b31d

Browse files
author
Rajul
committed
Tune mobile hero typing and fact sizing
1 parent 07d85cd commit 964b31d

File tree

3 files changed

+36
-19
lines changed

3 files changed

+36
-19
lines changed

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<h1 class="hero-title" data-text="the missing click." aria-label="the missing click.">
4141
<span class="type-ghost" aria-hidden="true">the missing click.</span>
4242
<span class="type-live" aria-hidden="true">
43-
<span id="typeTarget" class="type-target">the missing click.</span><span class="type-cursor" id="typeCursor">_</span>
43+
<span class="type-target"><span id="typeTarget" class="type-text">the missing click.</span><span class="type-cursor" id="typeCursor">_</span></span>
4444
</span>
4545
</h1>
4646
<p class="hero-subtitle">

docs/site.css

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,20 @@ input {
222222
}
223223

224224
.type-live {
225-
align-items: baseline;
226-
display: inline-flex;
225+
display: block;
227226
inset: 0;
228-
justify-content: center;
229227
position: absolute;
228+
text-align: center;
230229
width: 100%;
231230
}
232231

233232
.type-target {
234-
display: inline-block;
235-
white-space: pre-wrap;
233+
display: inline;
234+
white-space: normal;
235+
}
236+
237+
.type-text {
238+
white-space: normal;
236239
}
237240

238241
.type-cursor {
@@ -409,24 +412,24 @@ input {
409412
.fact-kicker {
410413
color: var(--accent);
411414
font-family: "JetBrains Mono", monospace;
412-
font-size: 0.76rem;
415+
font-size: 0.68rem;
413416
text-transform: uppercase;
414417
}
415418

416419
.fact-value {
417420
color: var(--text-primary);
418-
font-size: clamp(1.55rem, 2.8vw, 2.2rem);
421+
font-size: clamp(1.18rem, 2vw, 1.68rem);
419422
font-weight: 400;
420423
letter-spacing: 0;
421424
line-height: 1.05;
422-
margin-top: 14px;
425+
margin-top: 12px;
423426
}
424427

425428
.fact-copy {
426429
color: var(--text-secondary);
427-
font-size: 0.97rem;
430+
font-size: 0.88rem;
428431
line-height: 1.6;
429-
margin-top: 14px;
432+
margin-top: 12px;
430433
max-width: 30ch;
431434
}
432435

@@ -831,7 +834,7 @@ input {
831834

832835
.fact-card {
833836
min-height: auto;
834-
padding: 22px 20px;
837+
padding: 20px 18px;
835838
}
836839

837840
.hero-actions {
@@ -864,6 +867,19 @@ input {
864867
margin-top: 18px;
865868
}
866869

870+
.fact-kicker {
871+
font-size: 0.62rem;
872+
}
873+
874+
.fact-value {
875+
font-size: 1.08rem;
876+
}
877+
878+
.fact-copy {
879+
font-size: 0.82rem;
880+
line-height: 1.52;
881+
}
882+
867883
.cli-install {
868884
width: 100%;
869885
}

docs/site.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ document.documentElement.classList.remove("no-js");
22

33
const copyButton = document.getElementById("copyCommandButton");
44
const installCommand = document.getElementById("installCommand");
5+
const heroTitle = document.querySelector(".hero-title");
56
const typeTarget = document.getElementById("typeTarget");
67
const typeCursor = document.getElementById("typeCursor");
78
const typeSound = document.getElementById("typeSound");
@@ -17,8 +18,8 @@ if (copyButton && installCommand) {
1718
});
1819
}
1920

20-
if (typeTarget && typeCursor) {
21-
const phrase = typeTarget.textContent.trim();
21+
if (heroTitle && typeTarget && typeCursor) {
22+
const phrase = (heroTitle.dataset.text || typeTarget.textContent).trim();
2223
let audioUnlocked = false;
2324
let audioContext = null;
2425
let audioBuffer = null;
@@ -90,7 +91,7 @@ if (typeTarget && typeCursor) {
9091
loopToken += 1;
9192
typeTarget.textContent = "";
9293
typeCursor.classList.remove("is-typing");
93-
runTypeLoop(loopToken);
94+
runTypeLoop(loopToken, 40);
9495
} catch (error) {
9596
audioUnlocked = false;
9697
}
@@ -117,8 +118,8 @@ if (typeTarget && typeCursor) {
117118
source.start(0);
118119
};
119120

120-
const runTypeLoop = async (token) => {
121-
await wait(320);
121+
const runTypeLoop = async (token, initialDelay = 140) => {
122+
await wait(initialDelay);
122123

123124
while (token === loopToken) {
124125
typeCursor.classList.add("is-typing");
@@ -130,7 +131,7 @@ if (typeTarget && typeCursor) {
130131
const character = phrase[i - 1];
131132
typeTarget.textContent = phrase.slice(0, i);
132133
playKeySound(character);
133-
await wait(character === " " ? 84 : 92);
134+
await wait(character === " " ? 54 : 62);
134135
}
135136

136137
typeCursor.classList.remove("is-typing");
@@ -146,7 +147,7 @@ if (typeTarget && typeCursor) {
146147
}
147148

148149
typeCursor.classList.remove("is-typing");
149-
await wait(340);
150+
await wait(220);
150151
}
151152
};
152153

0 commit comments

Comments
 (0)