二十四節気で自動で変わる見出し帯|日付から季節の言葉・配色・あしらいを掛け替え
和の店のサイトの見出し帯を、今日の日付から二十四節気を判定して自動で掛け替えるヒーローです。帯には「立冬 ― 冬のはじまり」のような季節の言葉、節気ごとの地色と文字の色、端のあしらい(落葉・氷柱・梅の蕾など24種の線画SVG)が出て、節気が変わると400msのクロスフェードで入れ替わります。帯の右には「次の節気: 小雪 11月22日」と残り日数を出します。下の日付スライダーで今日から1年分(表の終わりが近いときは表の最後の1年分)を動かせ、溝は節気ごとの色で塗ってあるので1年の移り変わりが一目で分かります。節気の日付は国立天文台の令和8年・令和9年の暦要項の値を表で持ち(天文計算はしない)、今日が表の範囲外になったら、帯の上に「今日は節気の表の範囲外です」と出し、表の端の1年分を表示します(古い日付を今日として出しません)。24色はすべて白地と帯の地色の両方に4.5:1以上(WCAG AA)で、畳んだ欄から配色のCSS変数・今のあしらいのSVG・24色を並べた1200×630の色見本PNGを書き出せます。動きを控える設定ではフェードを省きます。依存ライブラリなし。
プレビュー
二十四節気で変わる見出し帯
2026年11月14日(土)今日
りっとう
立冬―冬のはじまり
二十四節気の21番目・あしらい: 落葉
次の節気: 小雪 11月22日あと8日
11月7日〜11月21日
24の節気の配色と書き出し(CSS変数・SVG・色見本PNG)
立冬 ― 冬のはじまり
説明の全文を読む
和の店のサイトの見出し帯を、今日の日付から二十四節気を判定して自動で掛け替えるヒーローです。帯には「立冬 ― 冬のはじまり」のような季節の言葉、節気ごとの地色と文字の色、端のあしらい(落葉・氷柱・梅の蕾など24種の線画SVG)が出て、節気が変わると400msのクロスフェードで入れ替わります。帯の右には「次の節気: 小雪 11月22日」と残り日数を出します。下の日付スライダーで今日から1年分(表の終わりが近いときは表の最後の1年分)を動かせ、溝は節気ごとの色で塗ってあるので1年の移り変わりが一目で分かります。節気の日付は国立天文台の令和8年・令和9年の暦要項の値を表で持ち(天文計算はしない)、今日が表の範囲外になったら、帯の上に「今日は節気の表の範囲外です」と出し、表の端の1年分を表示します(古い日付を今日として出しません)。24色はすべて白地と帯の地色の両方に4.5:1以上(WCAG AA)で、畳んだ欄から配色のCSS変数・今のあしらいのSVG・24色を並べた1200×630の色見本PNGを書き出せます。動きを控える設定ではフェードを省きます。依存ライブラリなし。
- 追加日:
- 2026-11-14
- 更新日:
- 2026-11-15
- 依存:
- なし
- tags
- #hero #page #seasonal #japanese-calendar #24-solar-terms #date-driven #css-variables #svg #crossfade #range-slider #share-image #a11y #reduced-motion #no-image
"use client";
/**
* 二十四節気で自動で変わる見出し帯(PGE-14)
*
* 既存のヒーローは演出(大きな文字・写真・3D・スクロール)が主役で中身は固定のため、本ブロックは
* 日付という1つの入力から「言葉・配色・あしらい」の3点を表で引いて掛け替える、暦に連動した帯にした。
* 英字の小見出し・見出しの「。」止め・末尾の矢印リンク・角丸・出現アニメは使わない。
*
* 技法メモ:
* 1. 判定は表引きだけ。節気の入りの日を昇順の表に持ち、「その日以前で最後の入り」を探す(天文計算はしない)。
* 日付は "YYYY-MM-DD" の文字列のまま比べる(辞書順=日付順)。日数の計算だけ Date.UTC を使う。
* 2. 24枚の層(帯の地色+あしらい)と24個の見出しを同じ場所に重ね、opacity だけを 400ms で入れ替える。
* 見出しは grid の同じセルに重ねるので、高さは最も長い言葉に合い、節気が変わっても帯の高さが揺れない。
* 3. 色は「濃い色(文字・線)」と、それを白へ13%だけ混ぜた「地色」の2つで1組。濃い色は白地・地色の両方に
* 4.5:1 以上(WCAG AA)を満たすものだけを使い、試験で全24組を計算して確かめる。
* 4. スライダーの溝は節気ごとの色を硬い区切りの linear-gradient で塗り、1年の移り変わりを溝そのもので見せる。
*/
import { useCallback, useId, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
import { Zen_Old_Mincho } from "next/font/google";
// preload: false は和文フォント必須(unicode-range で分割されるため、preload すると全ページに読み込みが付く)
const mincho = Zen_Old_Mincho({
weight: ["700"],
subsets: ["latin"],
display: "swap",
preload: false,
});
/** 節気の名前・読み・言葉・あしらいの名前・配色。並びは1年の順(小寒から冬至まで) */
export const SEKKI = [
{ key: "shoukan", name: "小寒", yomi: "しょうかん", phrase: "寒の入り", motif: "寒椿", ink: "#8a2432" },
{ key: "daikan", name: "大寒", yomi: "だいかん", phrase: "寒さの底", motif: "氷柱", ink: "#3b5873" },
{ key: "risshun", name: "立春", yomi: "りっしゅん", phrase: "春のはじまり", motif: "梅の蕾", ink: "#8c3b5e" },
{ key: "usui", name: "雨水", yomi: "うすい", phrase: "雪が雨に変わるころ", motif: "雨と波紋", ink: "#3d6670" },
{ key: "keichitsu", name: "啓蟄", yomi: "けいちつ", phrase: "虫が土から出るころ", motif: "双葉", ink: "#556626" },
{ key: "shunbun", name: "春分", yomi: "しゅんぶん", phrase: "昼と夜が同じ長さに", motif: "土筆", ink: "#7a5a12" },
{ key: "seimei", name: "清明", yomi: "せいめい", phrase: "草木が清らかに芽吹くころ", motif: "桜", ink: "#a33a5a" },
{ key: "kokuu", name: "穀雨", yomi: "こくう", phrase: "田畑をうるおす春の雨", motif: "藤", ink: "#6a4f8c" },
{ key: "rikka", name: "立夏", yomi: "りっか", phrase: "夏のはじまり", motif: "若葉", ink: "#2f6b3f" },
{ key: "shouman", name: "小満", yomi: "しょうまん", phrase: "草木が育ち満ちていくころ", motif: "麦の穂", ink: "#76601a" },
{ key: "boushu", name: "芒種", yomi: "ぼうしゅ", phrase: "田植えのころ", motif: "苗", ink: "#3f6b4a" },
{ key: "geshi", name: "夏至", yomi: "げし", phrase: "昼がいちばん長い日", motif: "紫陽花", ink: "#4a5aa0" },
{ key: "shousho", name: "小暑", yomi: "しょうしょ", phrase: "暑さが本格的になるころ", motif: "朝顔", ink: "#2f5f9e" },
{ key: "taisho", name: "大暑", yomi: "たいしょ", phrase: "暑さの盛り", motif: "団扇", ink: "#1f6a7a" },
{ key: "risshuu", name: "立秋", yomi: "りっしゅう", phrase: "秋のはじまり", motif: "桔梗", ink: "#5a4e96" },
{ key: "shosho", name: "処暑", yomi: "しょしょ", phrase: "暑さがやわらぐころ", motif: "稲穂", ink: "#805c16" },
{ key: "hakuro", name: "白露", yomi: "はくろ", phrase: "草に露が宿るころ", motif: "露", ink: "#3e6a78" },
{ key: "shuubun", name: "秋分", yomi: "しゅうぶん", phrase: "昼と夜が同じ長さに", motif: "月とすすき", ink: "#6b5a2e" },
{ key: "kanro", name: "寒露", yomi: "かんろ", phrase: "露が冷たく感じられるころ", motif: "菊", ink: "#8a5410" },
{ key: "soukou", name: "霜降", yomi: "そうこう", phrase: "霜が降りはじめるころ", motif: "紅葉", ink: "#a1381c" },
{ key: "rittou", name: "立冬", yomi: "りっとう", phrase: "冬のはじまり", motif: "落葉", ink: "#8a4a22" },
{ key: "shousetsu", name: "小雪", yomi: "しょうせつ", phrase: "雪がちらつきはじめるころ", motif: "小雪", ink: "#4f6170" },
{ key: "taisetsu", name: "大雪", yomi: "たいせつ", phrase: "雪が本格的に降るころ", motif: "雪の結晶", ink: "#2e4a6e" },
{ key: "touji", name: "冬至", yomi: "とうじ", phrase: "昼がいちばん短い日", motif: "柚子", ink: "#7f5c00" },
] as const;
/**
* 節気の入りの日(日本時間)。値は次の一次情報から写した:
* 国立天文台 暦計算室「令和8年(2026)暦要項 二十四節気および雑節」
* https://eco.mtk.nao.ac.jp/koyomi/yoko/2026/rekiyou262.html
* 国立天文台 暦計算室「令和9年(2027)暦要項 二十四節気および雑節」
* https://eco.mtk.nao.ac.jp/koyomi/yoko/2027/rekiyou272.html
* 各年とも小寒から冬至までの24個を SEKKI と同じ順で並べる。
*/
const ENTRY_DAYS: Record<number, readonly string[]> = {
2026: [
"01-05", "01-20", "02-04", "02-19", "03-05", "03-20", "04-05", "04-20", "05-05", "05-21", "06-06", "06-21",
"07-07", "07-23", "08-07", "08-23", "09-07", "09-23", "10-08", "10-23", "11-07", "11-22", "12-07", "12-22",
],
2027: [
"01-05", "01-20", "02-04", "02-19", "03-06", "03-21", "04-05", "04-20", "05-06", "05-21", "06-06", "06-21",
"07-07", "07-23", "08-08", "08-23", "09-08", "09-23", "10-08", "10-24", "11-08", "11-22", "12-07", "12-22",
],
};
export const SOURCES = [
{ label: "国立天文台 暦計算室「令和8年(2026)暦要項 二十四節気および雑節」", href: "https://eco.mtk.nao.ac.jp/koyomi/yoko/2026/rekiyou262.html" },
{ label: "国立天文台 暦計算室「令和9年(2027)暦要項 二十四節気および雑節」", href: "https://eco.mtk.nao.ac.jp/koyomi/yoko/2027/rekiyou272.html" },
] as const;
/** 昇順の入りの表({ date: "2026-01-05", index: 0 } …) */
export const ENTRIES = Object.entries(ENTRY_DAYS).flatMap(([y, days]) =>
days.map((md, index) => ({ date: `${y}-${md}`, index })),
);
export const TABLE_FIRST = ENTRIES[0].date;
export const TABLE_LAST = ENTRIES[ENTRIES.length - 1].date;
export type SekkiResult = {
index: number;
/** この節気の入りの日。表より前の日付では null(前年の冬至は表に持たない) */
start: string | null;
/** 次の節気。表の最後の節気(冬至)以降では null */
next: { index: number; date: string } | null;
/** 表の範囲外か */
outOfRange: "before" | "after" | null;
};
/** 日付("YYYY-MM-DD")から二十四節気を判定する。範囲外では最後の節気のまま返す */
export function sekkiAt(date: string): SekkiResult {
let i = -1;
for (let k = 0; k < ENTRIES.length; k++) {
if (ENTRIES[k].date <= date) i = k;
else break;
}
if (i < 0) {
// 表の最初(小寒)より前は前年の冬至の期間
return { index: 23, start: null, next: { index: ENTRIES[0].index, date: ENTRIES[0].date }, outOfRange: "before" };
}
const nextEntry = ENTRIES[i + 1] ?? null;
return {
index: ENTRIES[i].index,
start: ENTRIES[i].date,
next: nextEntry ? { index: nextEntry.index, date: nextEntry.date } : null,
// 表の最後の冬至から年末までは表の中。翌年に入ったら範囲外(冬至のまま返す)
outOfRange: date > `${TABLE_LAST.slice(0, 4)}-12-31` ? "after" : null,
};
}
const toUtc = (d: string) => Date.UTC(+d.slice(0, 4), +d.slice(5, 7) - 1, +d.slice(8, 10));
const fromUtc = (t: number) => new Date(t).toISOString().slice(0, 10);
export const addDays = (d: string, n: number) => fromUtc(toUtc(d) + n * 86400000);
export const daysBetween = (a: string, b: string) => Math.round((toUtc(b) - toUtc(a)) / 86400000);
const WEEK = ["日", "月", "火", "水", "木", "金", "土"];
export const md = (d: string) => `${+d.slice(5, 7)}月${+d.slice(8, 10)}日`;
const longDate = (d: string) => `${d.slice(0, 4)}年${md(d)}(${WEEK[new Date(toUtc(d)).getUTCDay()]})`;
// --- 配色 -------------------------------------------------------------------------------
const hexRgb = (h: string) => [1, 3, 5].map((i) => parseInt(h.slice(i, i + 2), 16));
/** 濃い色を白へ混ぜた地色(13%) */
export const washOf = (ink: string) =>
`#${hexRgb(ink).map((v) => Math.round(255 + (v - 255) * 0.13).toString(16).padStart(2, "0")).join("")}`;
const luminance = (h: string) => {
const [r, g, b] = hexRgb(h).map((v) => v / 255).map((v) => (v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4));
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
};
/** WCAG 2.x のコントラスト比 */
export function contrastRatio(a: string, b: string) {
const [x, y] = [luminance(a), luminance(b)].sort((p, q) => q - p);
return (x + 0.05) / (y + 0.05);
}
export const PALETTE = SEKKI.map((s) => ({ key: s.key, name: s.name, ink: s.ink, wash: washOf(s.ink) }));
/** 24色の配色トークン(CSS変数)。data-sekki で切り替える */
export function sekkiCss() {
const vars = PALETTE.map((p) => ` --sekki-${p.key}-ink: ${p.ink};\n --sekki-${p.key}-wash: ${p.wash};`).join("\n");
const sel = PALETTE.map(
(p) => `[data-sekki="${p.key}"] { --sekki-ink: var(--sekki-${p.key}-ink); --sekki-wash: var(--sekki-${p.key}-wash); }`,
).join("\n");
return `/* 二十四節気の配色。ink は文字と線、wash は帯の地色。どちらも白地と地色に対して 4.5:1 以上 */\n:root {\n${vars}\n}\n\n${sel}\n\n.sekki-band { background: var(--sekki-wash); color: var(--sekki-ink); }\n`;
}
// --- あしらい(線画のSVG・24種) --------------------------------------------------------
const ring = (n: number, step: number, el: (deg: number) => ReactNode) =>
Array.from({ length: n }, (_, i) => <g key={i} transform={`rotate(${i * step} 80 80)`}>{el(i * step)}</g>);
function tsukushi(x: number, top: number, base: number) {
const head = top + 40;
return (
<g>
<path d={`M${x} ${base} C${x} ${base - 20} ${x + 1} ${head + 20} ${x} ${head}`} />
{[0.3, 0.55, 0.8].map((t) => {
const y = base - (base - head) * t;
return <path key={t} d={`M${x - 5} ${y + 2} L${x + 5} ${y - 2}`} />;
})}
<path d={`M${x - 8} ${head} C${x - 8} ${top + 14} ${x - 4} ${top + 3} ${x} ${top} C${x + 4} ${top + 3} ${x + 8} ${top + 14} ${x + 8} ${head} Z`} />
<path d={`M${x - 7} ${head - 9} H${x + 7} M${x - 7} ${head - 19} H${x + 7} M${x - 5} ${head - 29} H${x + 5}`} />
</g>
);
}
function wisteria(x: number, y: number, n: number) {
return (
<g>
<path d={`M${x} ${y - 10} V${y}`} />
{Array.from({ length: n }, (_, i) => {
const r = 6.5 - i * (4 / n);
return <circle key={i} cx={x + (i % 2 ? 4 : -4)} cy={y + 4 + i * 11} r={r} />;
})}
</g>
);
}
function floret(cx: number, cy: number, a: number) {
return (
<g transform={`translate(${cx} ${cy}) rotate(${a})`}>
{[0, 90, 180, 270].map((d) => (
<path key={d} transform={`rotate(${d})`} d="M0 0 C-5 -3 -5 -10 0 -11 C5 -10 5 -3 0 0Z" />
))}
</g>
);
}
function fallingLeaf(cx: number, cy: number, rot: number, s: number) {
return (
<g transform={`translate(${cx} ${cy}) rotate(${rot}) scale(${s})`}>
<path d="M0 -17 C10 -8 10 8 0 17 C-10 8 -10 -8 0 -17Z" />
<path d="M0 -14 V24" />
</g>
);
}
function flake(cx: number, cy: number, r: number, branch: boolean) {
return (
<g transform={`translate(${cx} ${cy})`}>
{[0, 60, 120, 180, 240, 300].map((d) => (
<g key={d} transform={`rotate(${d})`}>
<path d={`M0 0 V${-r}`} />
{branch && (
<>
<path d={`M0 ${-r * 0.45} l${-r * 0.22} ${-r * 0.15} M0 ${-r * 0.45} l${r * 0.22} ${-r * 0.15}`} />
<path d={`M0 ${-r * 0.72} l${-r * 0.16} ${-r * 0.11} M0 ${-r * 0.72} l${r * 0.16} ${-r * 0.11}`} />
</>
)}
</g>
))}
{branch && <path d={`M${r * 0.18} 0 L${r * 0.09} ${r * 0.156} L${-r * 0.09} ${r * 0.156} L${-r * 0.18} 0 L${-r * 0.09} ${-r * 0.156} L${r * 0.09} ${-r * 0.156} Z`} />}
</g>
);
}
function mapleLeaf() {
// 5つの裂片の先(角度・半径)と、その間の切れ込みの半径
const tips = [
[-90, 50],
[-22, 44],
[38, 30],
[142, 30],
[202, 44],
];
const notch = [18, 16, 11, 16, 18];
const pt = (deg: number, r: number) => {
const t = (deg * Math.PI) / 180;
return `${(80 + r * Math.cos(t)).toFixed(1)} ${(78 + r * Math.sin(t)).toFixed(1)}`;
};
let d = "";
tips.forEach(([a, r], i) => {
const [na] = tips[(i + 1) % 5];
const mid = i === 2 ? 90 : (a + (na < a ? na + 360 : na)) / 2;
d += `${i ? "L" : "M"}${pt(a - 9, r * 0.72)} L${pt(a, r)} L${pt(a + 9, r * 0.72)} L${pt(mid, notch[i])} `;
});
return (
<g>
<path d={`${d}Z`} />
{tips.map(([a, r]) => (
<path key={a} d={`M80 78 L${pt(a, r * 0.82)}`} />
))}
<path d="M80 78 C80 100 82 124 88 146" />
</g>
);
}
/** 24種のあしらい。SEKKI と同じ順。viewBox 0 0 160 160・線だけで描く */
export const MOTIFS: ReactNode[] = [
// 小寒: 寒椿
<g key="0">
{ring(5, 72, () => <path d="M80 78 C62 66 60 40 80 32 C100 40 98 66 80 78Z" />)}
<circle cx="80" cy="80" r="11" />
<path d="M110 120 C124 112 140 118 150 134 C134 142 118 136 110 120Z M110 120 L148 133" />
</g>,
// 大寒: 氷柱
<g key="1">
<path d="M10 22 H150 M10 30 H150" />
{[[24, 52], [44, 100], [62, 70], [82, 118], [102, 84], [122, 104], [140, 58]].map(([x, len]) => (
<path key={x} d={`M${x - 7} 30 Q${x - 2} ${30 + len * 0.6} ${x} ${30 + len} Q${x + 2} ${30 + len * 0.6} ${x + 7} 30`} />
))}
<path d="M82 152 l0 4" />
</g>,
// 立春: 梅の蕾
<g key="2">
<path d="M12 148 C40 128 58 112 74 92 C88 74 104 58 148 40 M74 92 C84 98 98 100 112 94 M106 58 C106 46 112 34 120 24" />
<path d="M120 24 C114 18 116 8 122 6 C128 8 130 18 120 24Z M114 94 C114 86 122 82 126 86 C128 92 122 98 114 94Z M148 40 C146 32 152 26 157 28 C158 34 154 40 148 40Z" />
{ring(5, 72, () => <circle cx="80" cy="66" r="8" />).map((g, i) => (
<g key={i} transform="translate(-30 22)">{g}</g>
))}
<circle cx="50" cy="102" r="3" />
</g>,
// 雨水: 雨と波紋
<g key="3">
{[[30, 18], [62, 10], [96, 22], [128, 12], [44, 54], [80, 46], [114, 58], [146, 44], [26, 88], [62, 84], [100, 92], [136, 86]].map(([x, y]) => (
<path key={`${x}-${y}`} d={`M${x} ${y} l-6 16`} />
))}
<ellipse cx="58" cy="134" rx="26" ry="6" />
<ellipse cx="58" cy="134" rx="12" ry="2.6" />
<ellipse cx="116" cy="144" rx="20" ry="4.5" />
</g>,
// 啓蟄: 双葉
<g key="4">
<path d="M12 128 C50 121 110 121 148 128" />
<path d="M80 126 C80 112 80 100 80 88" />
<path d="M80 88 C66 70 44 70 32 80 C44 96 66 98 80 88Z M80 88 C92 66 116 62 130 72 C120 92 96 98 80 88Z" />
<path d="M44 146 c6 -7 17 -3 15 5 c-2 6 -10 6 -10 1" />
</g>,
// 春分: 土筆
<g key="5">
{tsukushi(62, 22, 148)}
{tsukushi(100, 54, 148)}
<path d="M30 148 H140" />
</g>,
// 清明: 桜
<g key="6">
{ring(5, 72, () => <path d="M80 78 C64 66 62 46 71 34 L80 43 L89 34 C98 46 96 66 80 78Z" />)}
<circle cx="80" cy="80" r="4" />
{ring(5, 72, () => <path d="M80 76 L80 64" />)}
<path transform="translate(128 132) rotate(30)" d="M0 10 C-8 4 -9 -6 -4 -12 L0 -7 L4 -12 C9 -6 8 4 0 10Z" />
</g>,
// 穀雨: 藤
<g key="7">
<path d="M8 20 C50 32 100 12 152 24" />
{wisteria(50, 30, 9)}
{wisteria(98, 24, 11)}
{wisteria(136, 26, 6)}
</g>,
// 立夏: 若葉
<g key="8">
<path d="M30 130 C40 80 80 40 138 28 C130 86 90 124 30 130Z" />
<path d="M30 130 C70 96 104 62 138 28 M18 146 L30 130" />
<path d="M56 108 L50 86 M78 88 L74 62 M102 66 L100 44 M56 108 L80 110 M78 88 L104 92 M102 66 L124 70" />
</g>,
// 小満: 麦の穂
<g key="9">
<path d="M80 152 C80 120 80 90 80 34" />
{[46, 62, 78, 94, 110].map((y) => (
<g key={y}>
<ellipse cx="71" cy={y} rx="5" ry="9" transform={`rotate(-30 71 ${y})`} />
<ellipse cx="89" cy={y} rx="5" ry="9" transform={`rotate(30 89 ${y})`} />
<path d={`M66 ${y - 8} L52 ${y - 32} M94 ${y - 8} L108 ${y - 32}`} />
</g>
))}
<ellipse cx="80" cy="30" rx="5" ry="9" />
<path d="M80 21 V2" />
</g>,
// 芒種: 苗
<g key="10">
<path d="M10 122 C28 118 44 126 62 122 S96 118 114 122 S140 126 150 122 M22 138 C40 134 56 142 74 138 S108 134 126 138" />
{[40, 80, 120].map((x) => (
<path key={x} d={`M${x} 124 C${x - 2} 102 ${x - 10} 88 ${x - 18} 78 M${x} 124 C${x} 100 ${x + 2} 84 ${x + 4} 66 M${x} 124 C${x + 4} 104 ${x + 12} 92 ${x + 20} 86`} />
))}
</g>,
// 夏至: 紫陽花
<g key="11">
{[[80, 40, 0], [58, 50, 20], [102, 50, 10], [42, 70, 40], [68, 66, 5], [92, 68, 30], [118, 70, 15], [54, 90, 25], [80, 88, 45], [106, 90, 0], [68, 108, 10], [94, 108, 35]].map(([x, y, a]) => (
<g key={`${x}-${y}`}>{floret(x, y, a)}</g>
))}
<path d="M60 124 C52 140 34 148 20 146 C24 132 40 122 60 124Z M100 124 C110 140 128 148 142 144 C138 130 120 120 100 124Z" />
</g>,
// 小暑: 朝顔
<g key="12">
<circle cx="70" cy="70" r="36" />
{ring(5, 72, () => <path d="M70 70 L70 34" />).map((g, i) => (
<g key={i} transform="translate(-10 -10)">{g}</g>
))}
<circle cx="70" cy="70" r="8" />
<path d="M94 98 C102 108 106 116 108 126 C118 140 140 132 138 116 C136 104 124 106 126 114" />
<path d="M128 68 C122 52 138 44 144 56 C154 52 156 68 142 78 C136 82 130 76 128 68Z" />
</g>,
// 大暑: 団扇
<g key="13">
<circle cx="80" cy="64" r="48" />
{[-160, -140, -120, -100, -80, -60, -40, -20].map((a) => {
const t = (a * Math.PI) / 180;
return <path key={a} d={`M80 108 L${(80 + 48 * Math.cos(t)).toFixed(1)} ${(64 + 48 * Math.sin(t)).toFixed(1)}`} />;
})}
<path d="M76 112 V154 M84 112 V154 M76 154 H84" />
</g>,
// 立秋: 桔梗
<g key="14">
{ring(5, 72, () => <path d="M80 78 C68 64 68 46 80 28 C92 46 92 64 80 78Z M80 72 V40" />)}
<circle cx="80" cy="80" r="5" />
<path d="M134 150 C122 138 124 118 134 110 C144 118 146 138 134 150Z M134 112 V148 M128 120 L134 128 L140 120" />
</g>,
// 処暑: 稲穂
<g key="15">
<path d="M28 152 C40 100 70 62 110 52 C130 48 142 58 146 72 M36 142 C60 122 80 114 108 110" />
{[[116, 46, -60], [128, 48, -30], [138, 56, -10], [145, 66, 10], [149, 78, 20], [148, 90, 30]].map(([x, y, a]) => (
<ellipse key={`${x}-${y}`} cx={x} cy={y} rx="4" ry="7.5" transform={`rotate(${a} ${x} ${y})`} />
))}
</g>,
// 白露: 露
<g key="16">
<path d="M38 152 C44 110 56 80 82 48 M70 152 C70 122 80 96 106 74 M100 152 C104 128 116 110 140 98" />
{[[66, 74], [98, 88], [126, 110], [52, 116]].map(([x, y]) => (
<path key={`${x}-${y}`} d={`M${x} ${y} C${x - 6} ${y + 8} ${x - 6} ${y + 15} ${x} ${y + 15} C${x + 6} ${y + 15} ${x + 6} ${y + 8} ${x} ${y}Z`} />
))}
</g>,
// 秋分: 月とすすき
<g key="17">
<circle cx="112" cy="44" r="26" />
<path d="M38 152 C42 112 50 82 64 52 M64 152 C70 122 80 98 98 80 M20 152 C26 128 30 112 30 96" />
{[[60, 60], [57, 70], [54, 80], [94, 84], [89, 90], [84, 96], [30, 100], [30, 110]].map(([x, y]) => (
<path key={`${x}-${y}`} d={`M${x} ${y} l9 -6 M${x} ${y} l-8 -7`} />
))}
</g>,
// 寒露: 菊
<g key="18">
{ring(16, 22.5, () => <path d="M80 80 C76 66 76 50 80 30 C84 50 84 66 80 80Z" />)}
{ring(8, 45, () => <path d="M80 80 C78 72 78 62 80 54 C82 62 82 72 80 80Z" />).map((g, i) => (
<g key={i} transform="rotate(11.25 80 80)">{g}</g>
))}
<circle cx="80" cy="80" r="7" />
</g>,
// 霜降: 紅葉
<g key="19">{mapleLeaf()}</g>,
// 立冬: 落葉
<g key="20">
{fallingLeaf(58, 46, -30, 1.25)}
{fallingLeaf(112, 84, 40, 1.05)}
{fallingLeaf(66, 124, -72, 0.9)}
<path d="M30 30 C20 52 44 62 34 86 M140 40 C150 58 132 66 140 88" strokeDasharray="3 7" />
</g>,
// 小雪: 小さな雪片
<g key="21">
{flake(50, 48, 14, false)}
{flake(112, 70, 10, false)}
{flake(72, 118, 12, false)}
{[[132, 30], [26, 96], [118, 128], [94, 34], [140, 104]].map(([x, y]) => (
<circle key={`${x}-${y}`} cx={x} cy={y} r="2" />
))}
</g>,
// 大雪: 雪の結晶
<g key="22">{flake(80, 80, 60, true)}</g>,
// 冬至: 柚子
<g key="23">
<circle cx="78" cy="96" r="44" />
<path d="M78 52 C78 46 80 40 84 36 M84 36 C96 20 120 16 136 22 C126 38 104 44 84 36Z M84 36 C100 30 116 26 136 22 M54 76 C58 68 64 62 72 60" />
{[[60, 100], [92, 82], [100, 112], [70, 124], [86, 104], [108, 96], [58, 116]].map(([x, y]) => (
<circle key={`${x}-${y}`} cx={x} cy={y} r="1.4" />
))}
</g>,
];
function Motif({ index, id, className }: { index: number; id?: string; className?: string }) {
return (
<svg
id={id}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 160 160"
fill="none"
stroke="currentColor"
strokeWidth="2.2"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
className={className}
>
{MOTIFS[index]}
</svg>
);
}
// --- 色見本PNG(1200×630) -----------------------------------------------------------------
const URL_TEXT = "designs.first-ch.com/d/sekki-seasonal-header";
async function renderSwatch(current: number, sans: string, serif: string) {
const W = 1200;
const H = 630;
const cv = document.createElement("canvas");
cv.width = W;
cv.height = H;
const ctx = cv.getContext("2d");
if (!ctx) return null;
ctx.fillStyle = "#fff";
ctx.fillRect(0, 0, W, H);
ctx.textBaseline = "alphabetic";
ctx.fillStyle = "#1c1917";
ctx.font = `700 40px ${serif}`;
ctx.fillText("二十四節気の配色 24色", 56, 84);
ctx.fillStyle = "#57534e";
ctx.font = `500 20px ${sans}`;
ctx.fillText("小寒から冬至まで。上が帯の地色、下が文字と線の色(どちらも白地に 4.5:1 以上)", 56, 122);
const x0 = 56;
const colW = (W - 112) / 24;
const top = 170;
const mid = 330;
const bottom = 520;
SEKKI.forEach((s, i) => {
const x = x0 + i * colW;
ctx.fillStyle = washOf(s.ink);
ctx.fillRect(x, top, colW, mid - top);
ctx.fillStyle = s.ink;
ctx.fillRect(x, mid, colW, bottom - mid);
// 節気の名前を縦に2文字
ctx.textAlign = "center";
ctx.font = `700 24px ${serif}`;
ctx.fillStyle = s.ink;
Array.from(s.name).forEach((ch, k) => ctx.fillText(ch, x + colW / 2, top + 40 + k * 30));
// 色コードは列の幅に収まらないので縦に回して書く
ctx.save();
ctx.translate(x + colW / 2 + 5, bottom - 14);
ctx.rotate(-Math.PI / 2);
ctx.textAlign = "left";
ctx.fillStyle = "#fff";
ctx.font = `600 15px ${sans}`;
ctx.fillText(s.ink.toUpperCase(), 0, 0);
ctx.restore();
if (i === current) {
ctx.fillStyle = "#d97706";
ctx.fillRect(x, top - 14, colW, 6);
ctx.fillRect(x, bottom + 8, colW, 6);
}
});
ctx.textAlign = "left";
// 区切りの細線
ctx.fillStyle = "#e7e5e4";
ctx.fillRect(0, 566, W, 1);
ctx.fillStyle = "#1c1917";
ctx.font = `700 20px ${sans}`;
ctx.fillText(`今の節気: ${SEKKI[current].name} ― ${SEKKI[current].phrase}`, 56, 606);
ctx.textAlign = "right";
ctx.fillStyle = "#57534e";
ctx.font = `500 17px ${sans}`;
ctx.fillText(URL_TEXT, W - 56, 606);
const blob = await new Promise<Blob | null>((r) => cv.toBlob(r, "image/png"));
return blob ? URL.createObjectURL(blob) : null;
}
// --- 本体 -------------------------------------------------------------------------------
/** サーバー描画と最初の描画で使う日付。マウント後に日本時間の今日へ置き換える */
const DEFAULT_TODAY = "2026-11-14";
const SPAN = 365;
const noop = () => () => {};
const tokyoToday = () =>
new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Tokyo", year: "numeric", month: "2-digit", day: "2-digit" }).format(new Date());
/** 表で判定できる最初と最後の日(最後の冬至の期間は大晦日まで) */
const DOMAIN_FIRST = "2026-01-01";
const DOMAIN_LAST = `${TABLE_LAST.slice(0, 4)}-12-31`;
/** スライダーの範囲: 今日から1年分。表の終わりが近いときは表の最後の1年分に寄せる */
export function domainFor(today: string) {
const latestStart = addDays(DOMAIN_LAST, -SPAN);
let start = today < DOMAIN_FIRST ? DOMAIN_FIRST : today;
if (start > latestStart) start = latestStart;
return { start, end: addDays(start, SPAN) };
}
/** 今日が表の範囲外か(範囲外なら、表示している日付は今日ではない) */
export const todayOutside = (today: string): "before" | "after" | null =>
today < DOMAIN_FIRST ? "before" : today > DOMAIN_LAST ? "after" : null;
const focusRing = "outline-none focus-visible:ring-2 focus-visible:ring-[#d97706] focus-visible:ring-offset-2";
function CopyLabel({ done, idle, ok }: { done: boolean; idle: string; ok: string }) {
return (
<span className="grid">
<span className={`[grid-area:1/1] transition-opacity duration-150 motion-reduce:transition-none ${done ? "opacity-0" : "opacity-100"}`}>{idle}</span>
<span aria-hidden={!done} className={`[grid-area:1/1] transition-opacity duration-150 motion-reduce:transition-none ${done ? "opacity-100" : "opacity-0"}`}>
{ok}
</span>
</span>
);
}
export default function SekkiSeasonalHeader() {
const uid = useId();
// 今日(日本時間)。サーバーと最初の描画は DEFAULT_TODAY にして hydration のずれを避ける
const today = useSyncExternalStore(noop, tokyoToday, () => DEFAULT_TODAY);
// 動かしていない間は今日に追従する(null=今日)
const [picked, setPicked] = useState<string | null>(null);
const [copied, setCopied] = useState<"css" | "svg" | null>(null);
const [png, setPng] = useState<{ url: string; index: number } | null>(null);
const rootRef = useRef<HTMLElement>(null);
const headRef = useRef<HTMLParagraphElement>(null);
const domain = useMemo(() => domainFor(today), [today]);
const clamp = useCallback(
(d: string) => (d < domain.start ? domain.start : d > domain.end ? domain.end : d),
[domain],
);
const date = clamp(picked ?? today);
const outside = todayOutside(today);
const setDate = (d: string) => setPicked(clamp(d));
const r = sekkiAt(date);
const cur = SEKKI[r.index];
const next = r.next ? SEKKI[r.next.index] : null;
const offset = daysBetween(domain.start, date);
const periodEnd = r.next ? addDays(r.next.date, -1) : null;
// 色見本は作ったときの節気のものだけ見せる(節気が変わったら作り直す)
const pngUrl = png && png.index === r.index ? png.url : null;
// 溝の色: 範囲内の節気ごとの区間を硬い区切りで塗る
const track = useMemo(() => {
const stops: string[] = [];
let d = domain.start;
while (d <= domain.end) {
const s = sekkiAt(d);
const end = s.next && s.next.date <= domain.end ? s.next.date : addDays(domain.end, 1);
const a = (daysBetween(domain.start, d) / (SPAN + 1)) * 100;
const b = (daysBetween(domain.start, end) / (SPAN + 1)) * 100;
stops.push(`${SEKKI[s.index].ink} ${a.toFixed(2)}% ${b.toFixed(2)}%`);
d = end;
}
return `linear-gradient(to right, ${stops.join(", ")})`;
}, [domain]);
const months = useMemo(() => {
const out: { label: string; pct: number; odd: boolean }[] = [];
let d = `${domain.start.slice(0, 7)}-01`;
let k = 0;
while (d <= domain.end) {
if (d >= domain.start) {
const m = +d.slice(5, 7);
out.push({ label: m === 1 ? `${d.slice(0, 4)}年1月` : `${m}月`, pct: (daysBetween(domain.start, d) / SPAN) * 100, odd: k % 2 === 1 });
k++;
}
const y = +d.slice(0, 4);
const m = +d.slice(5, 7);
d = m === 12 ? `${y + 1}-01-01` : `${y}-${String(m + 1).padStart(2, "0")}-01`;
}
return out;
}, [domain]);
const prevStart = (() => {
// 入りの日より後なら入りの日へ、入りの日ちょうどなら1つ前の節気の入りへ
if (r.start && r.start < date) return r.start;
const i = ENTRIES.findIndex((e) => e.date === r.start);
return i > 0 ? ENTRIES[i - 1].date : null;
})();
const canPrev = prevStart !== null && prevStart >= domain.start;
const canNext = r.next !== null && r.next.date <= domain.end;
/** 節気の一覧から選んだとき、範囲内でその節気が始まる日へ動かす */
const jumpTo = (index: number) => {
const hit = ENTRIES.find((e) => e.index === index && e.date >= domain.start && e.date <= domain.end);
if (hit) setDate(hit.date);
else if (index === 23) setDate(domain.start);
};
const copy = async (kind: "css" | "svg") => {
let text = sekkiCss();
if (kind === "svg") {
const el = document.getElementById(`${uid}-motif-${r.index}`);
if (!el) return;
text = el.outerHTML.replace(/ (id|class|aria-hidden)="[^"]*"/g, "");
}
try {
await navigator.clipboard.writeText(text);
} catch {
return;
}
setCopied(kind);
window.setTimeout(() => setCopied((c) => (c === kind ? null : c)), 1500);
};
const makePng = async () => {
const sans = rootRef.current ? getComputedStyle(rootRef.current).fontFamily : "sans-serif";
const serif = headRef.current ? getComputedStyle(headRef.current).fontFamily : "serif";
await document.fonts?.ready;
const url = await renderSwatch(r.index, sans, serif);
if (!url) return;
setPng((p) => {
if (p) URL.revokeObjectURL(p.url);
return { url, index: r.index };
});
};
const btn = `inline-flex min-h-11 items-center justify-center border px-3.5 text-[14px] font-bold transition-colors duration-150 motion-reduce:transition-none disabled:cursor-not-allowed disabled:opacity-40 ${focusRing}`;
return (
<section
ref={rootRef}
aria-labelledby={`${uid}-h`}
data-sekki={cur.key}
className="@container w-full max-w-5xl border border-stone-200 bg-white font-sans text-stone-900"
>
<h2 id={`${uid}-h`} className="sr-only">
二十四節気で変わる見出し帯
</h2>
{/* 見出し帯(結果) */}
<div className="relative isolate overflow-hidden border-b border-stone-200">
{/* 地色とあしらいの層(24枚を重ねて opacity だけを替える) */}
{SEKKI.map((s, i) => (
<div
key={s.key}
aria-hidden="true"
className={`absolute inset-0 -z-10 transition-opacity duration-[400ms] ease-out motion-reduce:transition-none ${i === r.index ? "opacity-100" : "opacity-0"}`}
style={{ background: washOf(s.ink), color: s.ink }}
>
<Motif
index={i}
id={`${uid}-motif-${i}`}
className="absolute right-4 bottom-[68px] size-[100px] @[40rem]:right-8 @[40rem]:bottom-6 @[40rem]:size-[180px] @[60rem]:size-[210px]"
/>
<div className="absolute inset-x-0 bottom-0 h-[3px]" style={{ background: s.ink }} />
</div>
))}
<div className="flex min-h-[360px] flex-col gap-5 px-5 py-5 @[40rem]:grid @[40rem]:min-h-[340px] @[40rem]:grid-cols-[minmax(0,1fr)_auto] @[40rem]:grid-rows-[auto_1fr] @[40rem]:gap-x-10 @[40rem]:px-10 @[40rem]:py-8">
<div className="@[40rem]:col-start-1 @[40rem]:row-start-1">
<p className="text-[14px] font-medium text-stone-700 tabular-nums">
{longDate(date)}
{date === today && <span className="ml-2 text-stone-500">今日</span>}
</p>
{outside && (
<p className="mt-2 max-w-[34em] border-l-2 border-[#d97706] pl-3 text-[13px] leading-[1.7] text-stone-700">
今日({longDate(today)})は節気の表の範囲外です。表の{outside === "after" ? "最後" : "最初"}の1年分を表示しています(表は2026年1月1日〜{longDate(DOMAIN_LAST)})。
</p>
)}
</div>
{/* 見出し(24個を同じセルに重ねる) */}
<div className="grid @[40rem]:col-start-1 @[40rem]:row-start-2 @[40rem]:self-center">
{SEKKI.map((s, i) => {
const on = i === r.index;
return (
<div
key={s.key}
aria-hidden={!on}
className={`[grid-area:1/1] transition-opacity duration-[400ms] ease-out motion-reduce:transition-none ${on ? "opacity-100" : "pointer-events-none opacity-0"}`}
style={{ color: s.ink }}
>
<p className="text-[13px] font-medium tracking-[0.2em]">{s.yomi}</p>
<p
ref={on ? headRef : undefined}
className={`${mincho.className} mt-1 text-[clamp(2.4rem,9cqi,4.6rem)] leading-[1.15] [word-break:keep-all]`}
>
{s.name}
{/* 「― 言葉」はひとかたまりで折り返し、帯の幅に合わせて大きさを決める(名前の大きさに連動させない) */}
<span className="inline-block align-middle text-[clamp(1.05rem,3.2cqi,1.9rem)] whitespace-nowrap">
<span className="mx-[0.5em]">―</span>
{s.phrase}
</span>
</p>
<p className="mt-3 text-[14px] text-stone-700 tabular-nums">
二十四節気の{i + 1}番目・あしらい: {s.motif}
</p>
</div>
);
})}
</div>
<div className="mt-auto border-t border-stone-900/10 pt-3 text-[14px] text-stone-800 @[40rem]:col-start-2 @[40rem]:row-start-1 @[40rem]:mt-0 @[40rem]:border-t-0 @[40rem]:pt-0 @[40rem]:text-right">
{next && r.next ? (
<p className="tabular-nums">
<span className="text-stone-600">次の節気: </span>
<span className="font-bold">
{next.name} {md(r.next.date)}
</span>
<span className="ml-2 text-stone-600">あと{daysBetween(date, r.next.date)}日</span>
</p>
) : (
<p className="text-stone-600">次の節気: 令和10年の暦要項の公表後に追加</p>
)}
<p className="mt-1 text-[13px] text-stone-600 tabular-nums">
{r.start ? md(r.start) : "前年12月"}〜{periodEnd ? md(periodEnd) : ""}
</p>
</div>
</div>
</div>
{/* 入力: 日付スライダー */}
<div className="px-5 pt-5 pb-4 @[40rem]:px-10">
<div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">
<label htmlFor={`${uid}-range`} className="text-[15px] font-bold">
日付を動かす
</label>
<div className="flex gap-2">
<button type="button" className={`${btn} sekki-prev border-stone-300 bg-white hover:border-stone-900`} disabled={!canPrev} onClick={() => prevStart && setDate(prevStart)}>
‹ 前の節気
</button>
<button type="button" className={`${btn} sekki-next border-stone-300 bg-white hover:border-stone-900`} disabled={!canNext} onClick={() => r.next && setDate(r.next.date)}>
次の節気 ›
</button>
<button type="button" className={`${btn} sekki-today ${date === today ? "border-stone-300 bg-white text-stone-600" : "border-stone-900 bg-stone-900 text-white hover:bg-stone-700"}`} onClick={() => setPicked(null)}>
今日
</button>
</div>
</div>
<div className="relative mt-4 h-11">
<div aria-hidden="true" className="absolute inset-x-0 top-1/2 h-3 -translate-y-1/2" style={{ background: track }} />
<input
id={`${uid}-range`}
type="range"
min={0}
max={SPAN}
step={1}
value={offset}
aria-valuetext={`${longDate(date)} ${cur.name}`}
onChange={(e) => setDate(addDays(domain.start, Number(e.target.value)))}
className={`sekki-range absolute inset-0 h-full w-full cursor-pointer appearance-none bg-transparent ${focusRing} [&::-moz-range-thumb]:size-7 [&::-moz-range-thumb]:rounded-none [&::-moz-range-thumb]:border-[3px] [&::-moz-range-thumb]:border-stone-900 [&::-moz-range-thumb]:bg-white [&::-moz-range-track]:bg-transparent [&::-webkit-slider-thumb]:size-7 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:border-[3px] [&::-webkit-slider-thumb]:border-stone-900 [&::-webkit-slider-thumb]:bg-white`}
/>
</div>
<div aria-hidden="true" className="relative mt-1 h-5 text-[12px] text-stone-500 tabular-nums">
{months.map((m) => (
<span
key={m.label + m.pct}
className={`absolute top-0 -translate-x-1/2 whitespace-nowrap ${m.odd ? "hidden @[40rem]:inline" : ""} ${m.pct > 96 || m.pct < 3 ? "hidden" : ""}`}
style={{ left: `${m.pct}%` }}
>
{m.label}
</span>
))}
</div>
</div>
{/* 畳む部分: 24の節気と書き出し */}
<details className="group border-t border-stone-200">
<summary className={`sekki-more flex min-h-12 cursor-pointer list-none items-center gap-2 px-5 text-[15px] font-bold @[40rem]:px-10 [&::-webkit-details-marker]:hidden ${focusRing}`}>
<span aria-hidden="true" className="inline-block text-[11px] transition-transform duration-150 group-open:rotate-90 motion-reduce:transition-none">
▸
</span>
24の節気の配色と書き出し(CSS変数・SVG・色見本PNG)
</summary>
<div className="px-5 pb-6 @[40rem]:px-10">
<div className="flex flex-wrap gap-2">
<button type="button" className={`${btn} sekki-copy-css border-stone-900 bg-stone-900 text-white hover:bg-stone-700`} onClick={() => copy("css")}>
<CopyLabel done={copied === "css"} idle="配色のCSS変数をコピー" ok="コピーしました ✓" />
</button>
<button type="button" className={`${btn} sekki-copy-svg border-stone-300 bg-white hover:border-stone-900`} onClick={() => copy("svg")}>
<CopyLabel done={copied === "svg"} idle={`「${cur.motif}」のSVGをコピー`} ok="コピーしました ✓" />
</button>
<button type="button" className={`${btn} sekki-png border-[#b45309] bg-white text-[#92400e] hover:bg-amber-50`} onClick={makePng}>
色見本PNGを作る
</button>
</div>
{pngUrl && (
<figure className="mt-4 border border-stone-200">
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={pngUrl} alt={`二十四節気の24色を並べた色見本。今の節気は${cur.name}`} width={1200} height={630} className="block h-auto w-full" />
<figcaption className="flex flex-wrap items-center justify-between gap-2 border-t border-stone-200 px-3 py-2 text-[13px] text-stone-600">
1200×630・SNSの共有画像の大きさ
<a href={pngUrl} download={`sekki-palette-${cur.key}.png`} className={`sekki-save inline-flex min-h-10 items-center bg-[#b45309] px-3 font-bold text-white hover:bg-[#92400e] ${focusRing}`}>
PNGを保存
</a>
</figcaption>
</figure>
)}
<ul className="mt-5 grid border-t border-stone-200 @[40rem]:grid-cols-2 @[40rem]:gap-x-8">
{SEKKI.map((s, i) => {
const wash = washOf(s.ink);
const on = i === r.index;
const at = ENTRIES.find((e) => e.index === i && e.date >= domain.start && e.date <= domain.end);
return (
<li key={s.key} className="border-b border-stone-200">
<button
type="button"
aria-current={on ? "true" : undefined}
onClick={() => jumpTo(i)}
className={`sekki-row-${s.key} flex min-h-12 w-full items-center gap-3 py-2 text-left hover:bg-stone-50 ${focusRing}`}
>
<span aria-hidden="true" className="grid size-9 flex-none place-items-center border" style={{ background: wash, borderColor: s.ink, color: s.ink }}>
<Motif index={i} className="size-7" />
</span>
<span className="min-w-0 flex-1">
<span className="block text-[15px] font-bold" style={{ color: s.ink }}>
{s.name}
<span className="ml-2 text-[12px] font-medium text-stone-500">{s.yomi}</span>
{on && <span className="ml-2 border-b-2 border-[#d97706] text-[12px] text-stone-800">表示中</span>}
</span>
<span className="block text-[12px] text-stone-600 tabular-nums">
{at ? md(at.date) : "範囲外"}・{s.ink}・白地 {contrastRatio(s.ink, "#ffffff").toFixed(1)}:1・帯 {contrastRatio(s.ink, wash).toFixed(1)}:1
</span>
</span>
</button>
</li>
);
})}
</ul>
</div>
</details>
<footer className="border-t border-stone-200 px-5 py-3 text-[12px] leading-[1.8] text-stone-600 @[40rem]:px-10">
節気の日付の出典:{" "}
{SOURCES.map((s, i) => (
<span key={s.href}>
{i > 0 && "、"}
<a href={s.href} target="_blank" rel="noopener noreferrer" className={`underline decoration-stone-300 underline-offset-4 hover:decoration-stone-600 ${focusRing}`}>
{s.label}
</a>
</span>
))}
。表は令和8年1月5日の小寒から令和9年の冬至まで。今日が表の範囲外のときは、帯の上にその旨を出し、表の端の1年分を表示します。
</footer>
{/* 中身が変わるのは節気が変わったときだけなので、読み上げも節気の切り替わりだけ */}
<p aria-live="polite" className="sr-only">
{cur.name} ― {cur.phrase}
</p>
</section>
);
}
shadcn CLI でプロジェクトに追加
npx shadcn@latest add https://designs.first-ch.com/r/sekki-seasonal-header.json