fix: 구역 제목의 급이 갈리던 것을 정본에 맞춘다

「구조별로 알게 된 것」만 26px·굵기 400 으로 나왔다. 형제 구역(「먼저 읽을 것」·「이 주제를
다룬 프로젝트」)은 30px·650 이라, 같은 화면에서 이 구역만 급이 낮아 디자인이 빠진 것처럼
보였다.

규칙이 없었던 게 아니라 절반만 있었다. 정본은 `.section-heading-row h2` 인데 그 안에
들어가지 않는 두 구역이 크기만 각자 적어 두어 굵기를 아무도 정하지 않았고, 그래서 기본값
400 으로 떨어졌다. 값을 정본과 맞추고, 나란히 서는 제목들이 다시 갈라지면 멈추는 검사를
둔다 — 굵기를 빼 보고 실제로 멈추는 것을 확인했다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-09-01 21:19:47 +09:00
co-authored by Claude Opus 5
parent 67a549173d
commit 68538f2e17
4 changed files with 62 additions and 5 deletions
@@ -2473,7 +2473,14 @@ dialog::backdrop {
.public-document-body > section + section { margin-top: 76px; padding-top: 70px; border-top: 1px solid var(--line); }
.public-document-body h2,
.reference-purpose h2,
.document-relations h2 { margin: 0 0 20px; font-size: 29px; font-weight: 650; letter-spacing: -0.038em; }
/*
구역 제목은 한 급이다. 정본은 `.section-heading-row h2` 이고(최근 기록·종류별로 읽기가 쓴다),
그 안에 들어가지 않는 두 구역이 크기만 각자 적어 두어 굵기를 아무도 정하지 않았다. 그래서
400 으로 떨어져, 같은 화면에서 「구조별로 알게 된 것」만 형제 구역보다 작고 가늘게 나왔다 —
디자인이 빠진 것처럼 보인 자리다. 값을 정본과 맞춘다.
*/
.document-relations h2,
.topic-variants h2 { margin: 0 0 20px; font-size: 30px; font-weight: 650; letter-spacing: -0.045em; }
.public-document-body h3 { margin: 0; font-size: 18px; font-weight: 630; }
.public-document-body p,
.public-document-body li,
@@ -2863,8 +2870,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
.topic-variants h2 {
margin: 10px 0 20px;
font-size: 26px;
letter-spacing: -0.03em;
}
.topic-variants ul {
@@ -2961,8 +2966,6 @@ textarea.studio-control { min-height: 118px; resize: vertical; line-height: 1.65
.home-comparison h2 {
margin: 10px 0 0;
font-size: 30px;
letter-spacing: -0.035em;
}
.home-comparison ul {
@@ -0,0 +1,54 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { test } from "vitest";
/**
* 한 화면에 나란히 서는 구역 제목은 같은 급이어야 한다.
*
* <p>정본은 `.section-heading-row h2` 다. 그 안에 들어가지 않는 두 구역이 크기만 각자 적어 두어
* 굵기를 아무도 정하지 않았고, 400 으로 떨어져 「구조별로 알게 된 것」만 형제 구역보다 작고
* 가늘게 나왔다 — 규칙이 없는 게 아니라 절반만 있었고, 그래서 「디자인이 안 됐다」로 보였다.
*/
const RAW = readFileSync("src/features/tech-log/presentation/styles/globals.css", "utf8");
/**
* 좁은 화면용 값은 뺀다. 화면 폭마다 급이 달라지는 것은 의도이고, 여기서 보려는 것은 같은
* 폭에서 나란히 설 때의 급이다.
*/
const CSS = RAW.replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/gu, "");
/** 나란히 서는 구역 제목들. 정본이 맨 앞이다. */
const SECTION_HEADINGS = [
".section-heading-row h2",
".document-relations h2",
".topic-variants h2",
] as const;
/** 마지막으로 선언된 값을 읽는다 — 뒤에 오는 규칙이 이긴다. */
function declared(selector: string, property: string): string | null {
const escaped = selector.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
const blocks = [
...CSS.matchAll(new RegExp(`(?:^|,|\\n)\\s*${escaped}\\s*(?:,[^{]*)?\\{([^}]*)\\}`, "gu")),
];
let value: string | null = null;
for (const block of blocks) {
const found = new RegExp(`${property}:\\s*([^;]+)`, "u").exec(block[1]!);
if (found) value = found[1]!.trim();
}
return value;
}
test("나란히 서는 구역 제목이 같은 크기와 굵기를 쓴다", () => {
const canonical = SECTION_HEADINGS[0];
for (const property of ["font-size", "font-weight"]) {
const want = declared(canonical, property);
assert.ok(want, `${canonical} 에 ${property} 가 없다 — 정본이 값을 갖고 있어야 한다`);
for (const selector of SECTION_HEADINGS.slice(1)) {
assert.equal(
declared(selector, property),
want,
`${selector} 의 ${property} 가 ${canonical} 과 다르다`,
);
}
}
});
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 787 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB