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
align-items: center;
6
box-shadow: 0 2.4vh 1.2vh -2vh #808080;
7
display: flex;
0
8
height: var(--header-viewport-proportion);
9
-
justify-content: space-between;
10
min-height: var(--min-header-height);
0
11
position: relative;
12
}
13
···
16
font-weight: bold;
17
font-size: 6vh;
18
margin: auto;
19
-
overflow: hidden;
20
padding-left: 3%;
21
white-space: nowrap;
22
···
5
align-items: center;
6
box-shadow: 0 2.4vh 1.2vh -2vh #808080;
7
display: flex;
8
+
flex-flow: row-reverse wrap-reverse;
9
height: var(--header-viewport-proportion);
10
+
justify-content: center;
11
min-height: var(--min-header-height);
12
+
overflow: hidden;
13
position: relative;
14
}
15
···
18
font-weight: bold;
19
font-size: 6vh;
20
margin: auto;
0
21
padding-left: 3%;
22
white-space: nowrap;
23
-13
frontend/src/ts/header.ts
···
1
-
function toggleHeader() {
2
-
const title = document.getElementById("title")!;
3
-
4
-
// Title must be showing before scrollWidth is calculated.
5
-
title.style.display = "";
6
-
if (title.scrollWidth > title.offsetWidth) {
7
-
title.style.display = "none";
8
-
}
9
-
}
10
-
11
-
window.addEventListener("resize", toggleHeader);
12
-
13
-
toggleHeader();
···
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
frontend/src/ts/main.ts
···
4
import "./htmx";
5
import "htmx-ext-sse";
6
7
-
import "./header";
8
import "./logo";
···
4
import "./htmx";
5
import "htmx-ext-sse";
6
0
7
import "./logo";
+1
-1
server/templates/index.html
···
9
</head>
10
<body>
11
<div class="header-container">
12
-
<h1 class="title" id="title">Heya, gang!</h1>
13
<canvas class="logo-gl" id="spinningCanvas">spinning 'Ivo' text</canvas>
0
14
</div>
15
<h1>My projects</h1>
16
<div class="projects">
···
9
</head>
10
<body>
11
<div class="header-container">
0
12
<canvas class="logo-gl" id="spinningCanvas">spinning 'Ivo' text</canvas>
13
+
<h1 class="title" id="title">Heya, gang!</h1>
14
</div>
15
<h1>My projects</h1>
16
<div class="projects">