|
| 1 | +import { type DefaultTheme, defineConfig } from "vitepress"; |
| 2 | + |
| 3 | +export const ja = defineConfig({ |
| 4 | + lang: "ja", |
| 5 | + title: "Frontend Fundamentals", |
| 6 | + description: "変更しやすいフロントエンドコードのためのガイドライン", |
| 7 | + lastUpdated: true, |
| 8 | + head: [ |
| 9 | + ["link", { rel: "icon", href: "/images/favicon.ico" }], |
| 10 | + [ |
| 11 | + "meta", |
| 12 | + { |
| 13 | + property: "og:image", |
| 14 | + content: "https://static.toss.im/illusts/ff-meta.png" |
| 15 | + } |
| 16 | + ], |
| 17 | + [ |
| 18 | + "meta", |
| 19 | + { |
| 20 | + name: "twitter:image", |
| 21 | + content: "https://static.toss.im/illusts/ff-meta.png" |
| 22 | + } |
| 23 | + ], |
| 24 | + [ |
| 25 | + "meta", |
| 26 | + { |
| 27 | + name: "twitter:card", |
| 28 | + content: "https://static.toss.im/illusts/ff-meta.png" |
| 29 | + } |
| 30 | + ] |
| 31 | + ], |
| 32 | + themeConfig: { |
| 33 | + logo: "/images/ff-symbol.svg", |
| 34 | + nav: nav(), |
| 35 | + |
| 36 | + editLink: { |
| 37 | + pattern: "https://github.com/toss/frontend-fundamentals/edit/main/:path", |
| 38 | + text: "GitHubで修正する" |
| 39 | + }, |
| 40 | + |
| 41 | + outline: { |
| 42 | + label: "ページの内容" |
| 43 | + }, |
| 44 | + docFooter: { |
| 45 | + prev: "前のページ", |
| 46 | + next: "次のページ" |
| 47 | + }, |
| 48 | + lastUpdated: { |
| 49 | + text: "最後のアップデート" |
| 50 | + }, |
| 51 | + |
| 52 | + socialLinks: [ |
| 53 | + { |
| 54 | + icon: "github", |
| 55 | + link: "https://github.com/toss/frontend-fundamentals" |
| 56 | + } |
| 57 | + ], |
| 58 | + |
| 59 | + sidebar: sidebar() |
| 60 | + } |
| 61 | +}); |
| 62 | + |
| 63 | +function nav(): DefaultTheme.NavItem[] { |
| 64 | + return [{ text: "ホーム", link: "/ja" }]; |
| 65 | +} |
| 66 | + |
| 67 | +function sidebar(): DefaultTheme.Sidebar { |
| 68 | + return [ |
| 69 | + { |
| 70 | + text: "良いコードの基準", |
| 71 | + items: [ |
| 72 | + { |
| 73 | + text: "はじめる", |
| 74 | + link: "/ja/code/start" |
| 75 | + }, |
| 76 | + { |
| 77 | + text: "変更しやすいコード", |
| 78 | + link: "/ja/code/" |
| 79 | + }, |
| 80 | + { |
| 81 | + text: "コミュニティ", |
| 82 | + items: [ |
| 83 | + { |
| 84 | + text: "紹介", |
| 85 | + link: "/code/community" |
| 86 | + }, |
| 87 | + { |
| 88 | + text: "⭐ 良い討論をまとめて見る", |
| 89 | + link: "https://github.com/toss/frontend-fundamentals/discussions?discussions_q=is%3Aopen+label%3A%22성지+⛲%22" |
| 90 | + }, |
| 91 | + { |
| 92 | + text: "A vs B", |
| 93 | + link: "https://github.com/toss/frontend-fundamentals/discussions/categories/a-vs-b?discussions_q=is%3Aopen+category%3A%22A+vs+B%22+sort%3Adate_created" |
| 94 | + }, |
| 95 | + { |
| 96 | + text: "自由におしゃべり", |
| 97 | + link: "https://github.com/toss/frontend-fundamentals/discussions/categories/open-forum?discussions_q=is%3Aopen+sort%3Adate_created+category%3A%22Open+Forum%22" |
| 98 | + } |
| 99 | + ], |
| 100 | + collapsed: true |
| 101 | + } |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + text: "良いコードを書くための戦略", |
| 106 | + items: [ |
| 107 | + { |
| 108 | + text: "1. 可読性", |
| 109 | + items: [ |
| 110 | + { |
| 111 | + text: "コンテキストを減らす", |
| 112 | + items: [ |
| 113 | + { |
| 114 | + text: "A. 一緒に実行されないコードを分離する", |
| 115 | + link: "/ja/code/examples/submit-button" |
| 116 | + }, |
| 117 | + { |
| 118 | + text: "B. 実装の詳細を抽象化する", |
| 119 | + link: "/ja/code/examples/login-start-page" |
| 120 | + }, |
| 121 | + { |
| 122 | + text: "C. ロジックの種類に応じて一体化している関数を分ける", |
| 123 | + link: "/ja/code/examples/use-page-state-readability" |
| 124 | + } |
| 125 | + ], |
| 126 | + collapsed: true |
| 127 | + }, |
| 128 | + { |
| 129 | + text: "名前付け", |
| 130 | + items: [ |
| 131 | + { |
| 132 | + text: "A. 複雑な条件に名前を付ける", |
| 133 | + link: "/ja/code/examples/condition-name" |
| 134 | + }, |
| 135 | + { |
| 136 | + text: "B. マジックナンバーに名前を付ける", |
| 137 | + link: "/ja/code/examples/magic-number-readability" |
| 138 | + } |
| 139 | + ], |
| 140 | + collapsed: true |
| 141 | + }, |
| 142 | + { |
| 143 | + text: "上から下へ読めるようにする", |
| 144 | + items: [ |
| 145 | + { |
| 146 | + text: "A. 視点の移動を減らす", |
| 147 | + link: "/ja/code/examples/user-policy" |
| 148 | + }, |
| 149 | + { |
| 150 | + text: "B. 三項演算子をシンプルにする", |
| 151 | + link: "/ja/code/examples/ternary-operator" |
| 152 | + } |
| 153 | + ], |
| 154 | + collapsed: true |
| 155 | + } |
| 156 | + ] |
| 157 | + }, |
| 158 | + |
| 159 | + { |
| 160 | + text: "2. 予測可能性", |
| 161 | + items: [ |
| 162 | + { |
| 163 | + text: "A. 名前が被らないように管理する", |
| 164 | + link: "/ja/code/examples/http" |
| 165 | + }, |
| 166 | + { |
| 167 | + text: "B. 同じ種類の関数は返り値の型を統一する", |
| 168 | + link: "/ja/code/examples/use-user" |
| 169 | + }, |
| 170 | + { |
| 171 | + text: "C. 隠れたロジックを露呈させる", |
| 172 | + link: "/ja/code/examples/hidden-logic" |
| 173 | + } |
| 174 | + ] |
| 175 | + }, |
| 176 | + { |
| 177 | + text: "3. 凝集度", |
| 178 | + items: [ |
| 179 | + { |
| 180 | + text: "A. 緒に修正されるファイルは同じディレクトリに置く", |
| 181 | + link: "/ja/code/examples/code-directory" |
| 182 | + }, |
| 183 | + { |
| 184 | + text: "B. マジックナンバーを排除する", |
| 185 | + link: "/ja/code/examples/magic-number-cohesion" |
| 186 | + }, |
| 187 | + { |
| 188 | + text: "C. フォームの凝集度について考える", |
| 189 | + link: "/ja/code/examples/form-fields" |
| 190 | + } |
| 191 | + ] |
| 192 | + }, |
| 193 | + { |
| 194 | + text: "4. 結合度", |
| 195 | + items: [ |
| 196 | + { |
| 197 | + text: "A. 責任を一つずつ管理する", |
| 198 | + link: "/ja/code/examples/use-page-state-coupling" |
| 199 | + }, |
| 200 | + { |
| 201 | + text: "B. 重複コードを許容する", |
| 202 | + link: "/ja/code/examples/use-bottom-sheet" |
| 203 | + }, |
| 204 | + { |
| 205 | + text: "C. Props Drilling を解消する", |
| 206 | + link: "/ja/code/examples/item-edit-modal" |
| 207 | + } |
| 208 | + ] |
| 209 | + } |
| 210 | + ] |
| 211 | + } |
| 212 | + ]; |
| 213 | +} |
| 214 | + |
| 215 | +export const search: DefaultTheme.LocalSearchOptions["locales"] = { |
| 216 | + root: { |
| 217 | + translations: { |
| 218 | + button: { |
| 219 | + buttonText: "検索", |
| 220 | + buttonAriaLabel: "検索" |
| 221 | + }, |
| 222 | + modal: { |
| 223 | + backButtonTitle: "戻る", |
| 224 | + displayDetails: "もっとみる", |
| 225 | + footer: { |
| 226 | + closeKeyAriaLabel: "閉じる", |
| 227 | + closeText: "閉じる", |
| 228 | + navigateDownKeyAriaLabel: "下へ", |
| 229 | + navigateText: "移動", |
| 230 | + navigateUpKeyAriaLabel: "上へ", |
| 231 | + selectKeyAriaLabel: "選択", |
| 232 | + selectText: "選択" |
| 233 | + }, |
| 234 | + noResultsText: "検索結果がありませんでした。", |
| 235 | + resetButtonTitle: "すべて消去" |
| 236 | + } |
| 237 | + } |
| 238 | + } |
| 239 | +}; |
0 commit comments