Repository navigation
SWF(refactor): ナビの項目定義と active 判定を共通化し cn() を使う - #816
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
blog | e813e29 | Commit Preview URL Branch Preview URL |
Nov 20 2026, 03:47 AM |
QA 結果: 合格ナビゲーションは全12条件で合格しました。Chromium で PR の
不合格の項目はありません。録画は代表的な操作を収めたもので、全条件の比較は別にブラウザーの自動操作で実行しました。 ナビ以外で気づいたこと録画中、記事のリンクカード画像2件で DevTools に |
ナビの Blog/About の定義と active 判定を
src/lib/navigation.tsにまとめ、クラスの結合をcn()に置き換えました。見た目と動作は変わりません。Closes #732
Summary
HeaderNavItem.astroとFooterNavItem.astroに同じ active 判定があり、HeaderNav.astroとFooterNav.astroには Blog/About の定義が重複していました。navItemsとisNavItemActive(path, currentPath)をsrc/lib/navigation.tsに移しました。判定の式は元のままです(/postsの前方一致も残しています)。cn()に替えました。HeaderNavItem・FooterNavItemのクラス結合をcn()に揃える #732 が挙げた 2 箇所はこの変更で解消します。text-gray-900の重複もcn()で解消します。アクティブ時は twMerge が上書きされるtext-gray-600を取り除くので、文字色のクラスはtext-gray-900だけが残ります。出力 HTML の差分
変更前(main)と変更後で
pnpm run build:ciを実行し、distの HTML 48 ファイルを比べました。text-gray-600とdark:text-gray-400が消えたことだけです。cn()の twMerge が、あとに書かれたtext-gray-900/dark:text-whiteに上書きされるクラスを取り除くためで、適用されるスタイルは同じです。aria-currentは変わっていません。posts/wishlist-2024-04/にはビルドごとの外部リンクカード取得による差分がありますが、今回の変更とは関係ありません。この差分と上記の正規化を除くとdiff -rは一致しました(exit 0)。実行結果
pnpm exec vitest run navigation --reporter=verbosepnpm run test:unit: 8 files / 145 tests passedpnpm run lint: 0 errors, 0 warningspnpm exec playwright test tests/e2e/specs/navigation.spec.ts --project=chromium: 8 passed, 1 skipped(モバイル専用のテスト)試すコマンド:
pnpm exec vitest run navigation && pnpm exec playwright test tests/e2e/specs/navigation.spec.ts --project=chromium未確認
Implemented in session Share nav active-path logic and use cn()
Review with Devin · Open in Devin Desktop