Skip to content

Commit e1a97a0

Browse files
committed
style(header): ASCII 브랜딩 및 네비게이션 스타일 개선
- 헤더 브랜딩 영역을 ASCII 아트 로고 기반으로 재구성하고 반응형 스케일을 조정함\n- 네비게이션 링크의 슬래시/italic 스타일을 제거하고 선택 항목에 dotted 하단선을 적용함\n- 루트(/)와 /blog 경로를 동치로 인식하도록 active 판별 로직을 보강함
1 parent b91a94a commit e1a97a0

File tree

2 files changed

+71
-34
lines changed

2 files changed

+71
-34
lines changed

src/components/Header.astro

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ import { SITE_TITLE } from '../consts';
33
import HeaderLink from './HeaderLink.astro';
44
---
55

6-
<header>
6+
<header class="site-header">
77
<nav>
88
<a href="/" class="site-branding">
9-
<img src="/mexicorea.png" alt="mexicorea" class="profile-pic" />
10-
<h2>{SITE_TITLE}</h2>
9+
<span class="sr-only">{SITE_TITLE}</span>
10+
<pre class="ascii-brand" aria-hidden="true">███╗ ███╗███████╗██╗ ██╗██╗ ██████╗ ██████╗ ██████╗ ███████╗ █████╗
11+
████╗ ████║██╔════╝╚██╗██╔╝██║██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔══██╗
12+
██╔████╔██║█████╗ ╚███╔╝ ██║██║ ██║ ██║██████╔╝█████╗ ███████║
13+
██║╚██╔╝██║██╔══╝ ██╔██╗ ██║██║ ██║ ██║██╔══██╗██╔══╝ ██╔══██║
14+
██║ ╚═╝ ██║███████╗██╔╝ ██╗██║╚██████╗╚██████╔╝██║ ██║███████╗██║ ██║
15+
╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝</pre>
1116
</a>
1217
<div class="internal-links">
13-
<HeaderLink href="/">/blog</HeaderLink>
14-
<HeaderLink href="/gallery">/gallery</HeaderLink>
15-
<HeaderLink href="/about">/about</HeaderLink>
18+
<HeaderLink href="/">blog</HeaderLink>
19+
<HeaderLink href="/gallery">gallery</HeaderLink>
20+
<HeaderLink href="/about">about</HeaderLink>
1621
</div>
1722
<!-- social-links hidden for now
1823
<div class="social-links">
@@ -22,36 +27,50 @@ import HeaderLink from './HeaderLink.astro';
2227
</nav>
2328
</header>
2429
<style>
25-
header {
30+
.site-header {
2631
margin: 0;
2732
padding: 0 1em;
2833
background: linear-gradient(var(--gray-gradient)) no-repeat;
2934
}
3035
.site-branding {
3136
justify-self: start;
32-
display: flex;
37+
display: block;
3338
align-items: center;
34-
gap: 0.5em;
3539
text-decoration: none;
36-
color: var(--black);
37-
padding: 1em 0.5em; /* Match original nav a padding */
40+
color: rgb(var(--black));
41+
padding: 0;
42+
height: 36px;
43+
width: min(42vw, 300px);
44+
max-width: min(42vw, 300px);
45+
overflow: hidden;
46+
position: relative;
3847
}
3948
.site-branding:hover {
4049
text-decoration: none;
4150
}
42-
img.profile-pic {
43-
width: 34px !important;
44-
max-width: 34px;
45-
height: 34px !important;
46-
border-radius: 50%;
47-
object-fit: cover;
48-
aspect-ratio: 1 / 1;
49-
flex-shrink: 0;
50-
}
51-
h2 {
51+
.ascii-brand {
5252
margin: 0;
53-
font-size: 1.2em;
54-
color: inherit;
53+
color: var(--accent-dark);
54+
font-family:
55+
"IBM Plex Mono",
56+
"Fira Code",
57+
"JetBrains Mono",
58+
"SFMono-Regular",
59+
Menlo,
60+
Monaco,
61+
Consolas,
62+
"Liberation Mono",
63+
"Courier New",
64+
monospace;
65+
font-size: 1rem;
66+
line-height: 1;
67+
letter-spacing: 0;
68+
white-space: pre;
69+
position: absolute;
70+
left: 0;
71+
top: 50%;
72+
transform: translateY(-50%) scale(0.34);
73+
transform-origin: left center;
5574
}
5675
nav {
5776
display: grid;
@@ -64,18 +83,20 @@ import HeaderLink from './HeaderLink.astro';
6483
gap: 2em;
6584
}
6685
.internal-links a {
67-
font-style: italic;
68-
}
69-
/* Removed generic nav a styling collision potential, kept specific ones or relied on inheritance */
70-
nav a.active {
71-
text-decoration: none;
72-
border-bottom-color: var(--accent);
86+
font-style: normal;
7387
}
7488
.social-links,
7589
.social-links a {
7690
display: flex;
7791
}
7892
@media (max-width: 720px) {
93+
.site-branding {
94+
width: min(52vw, 220px);
95+
max-width: min(52vw, 220px);
96+
}
97+
.ascii-brand {
98+
transform: translateY(-50%) scale(0.27);
99+
}
79100
.social-links {
80101
display: none;
81102
}

src/components/HeaderLink.astro

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@ import type { HTMLAttributes } from 'astro/types';
44
type Props = HTMLAttributes<'a'>;
55
66
const { href, class: className, ...props } = Astro.props;
7-
const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, '');
8-
const subpath = pathname.match(/[^\/]+/g);
9-
const isActive = href === pathname || href === '/' + (subpath?.[0] || '');
7+
const normalizePath = (value: string) => {
8+
const trimmed = value.replace(import.meta.env.BASE_URL, '').replace(/\/+$/, '');
9+
return trimmed === '' ? '/' : trimmed;
10+
};
11+
12+
const pathname = normalizePath(Astro.url.pathname);
13+
const hrefPath = normalizePath(String(href ?? '/'));
14+
15+
let isActive = false;
16+
if (hrefPath === '/') {
17+
isActive = pathname === '/' || pathname === '/blog' || pathname.startsWith('/blog/');
18+
} else {
19+
isActive = pathname === hrefPath || pathname.startsWith(`${hrefPath}/`);
20+
}
1021
---
1122

1223
<a href={href} class:list={[className, { active: isActive }]} {...props}>
@@ -16,9 +27,14 @@ const isActive = href === pathname || href === '/' + (subpath?.[0] || '');
1627
a {
1728
display: inline-block;
1829
text-decoration: none;
30+
font-style: normal !important;
31+
line-height: 1.2;
32+
padding-bottom: 0.12em;
33+
border-bottom: 2px dotted transparent;
1934
}
2035
a.active {
21-
font-weight: bolder;
22-
text-decoration: underline;
36+
text-decoration: none !important;
37+
border-bottom-color: currentColor;
38+
font-weight: inherit;
2339
}
2440
</style>

0 commit comments

Comments
 (0)