tangled
alpha
login
or
join now
cherry.computer
/
website
My personal site
cherry.computer
htmx
tailwind
axum
askama
0
fork
atom
overview
issues
pulls
pipelines
feat: replace header JS hack with pure CSS
cherry.computer
1 year ago
944eb61a
9dbbd063
verified
This commit was signed with the committer's
known signature
.
cherry.computer
SSH Key Fingerprint:
SHA256:SIA77Ll0IpMb8Xd3RtaGT+PBIGIePhJJg5W2r6Td7cc=
+4
-17
4 changed files
expand all
collapse all
unified
split
frontend
src
css
header.css
ts
header.ts
main.ts
server
templates
index.html
+3
-2
frontend/src/css/header.css
···
5
5
align-items: center;
6
6
box-shadow: 0 2.4vh 1.2vh -2vh #808080;
7
7
display: flex;
8
8
+
flex-flow: row-reverse wrap-reverse;
8
9
height: var(--header-viewport-proportion);
9
9
-
justify-content: space-between;
10
10
+
justify-content: center;
10
11
min-height: var(--min-header-height);
12
12
+
overflow: hidden;
11
13
position: relative;
12
14
}
13
15
···
16
18
font-weight: bold;
17
19
font-size: 6vh;
18
20
margin: auto;
19
19
-
overflow: hidden;
20
21
padding-left: 3%;
21
22
white-space: nowrap;
22
23
-13
frontend/src/ts/header.ts
···
1
1
-
function toggleHeader() {
2
2
-
const title = document.getElementById("title")!;
3
3
-
4
4
-
// Title must be showing before scrollWidth is calculated.
5
5
-
title.style.display = "";
6
6
-
if (title.scrollWidth > title.offsetWidth) {
7
7
-
title.style.display = "none";
8
8
-
}
9
9
-
}
10
10
-
11
11
-
window.addEventListener("resize", toggleHeader);
12
12
-
13
13
-
toggleHeader();
-1
frontend/src/ts/main.ts
···
4
4
import "./htmx";
5
5
import "htmx-ext-sse";
6
6
7
7
-
import "./header";
8
7
import "./logo";
+1
-1
server/templates/index.html
···
9
9
</head>
10
10
<body>
11
11
<div class="header-container">
12
12
-
<h1 class="title" id="title">Heya, gang!</h1>
13
12
<canvas class="logo-gl" id="spinningCanvas">spinning 'Ivo' text</canvas>
13
13
+
<h1 class="title" id="title">Heya, gang!</h1>
14
14
</div>
15
15
<h1>My projects</h1>
16
16
<div class="projects">