diff --git a/guide/app/layout.tsx b/guide/app/layout.tsx index 60195ab8..f36b9205 100644 --- a/guide/app/layout.tsx +++ b/guide/app/layout.tsx @@ -6,76 +6,142 @@ import { usePageLoaderData, MainNavigation, } from '~/components'; -import { logo } from '~/util'; +import { allLanguages, getLanguage, logo } from '~/util'; -const menus: Menu[] = [ - { - title: 'Getting Started', - links: [ - { title: 'Overview', to: '/' }, - { title: 'Tutorial', to: '/tutorial' }, - { title: 'Upgrading to v1', to: '/upgrading-v1' }, - { title: 'GitHub', to: 'https://github.com/edmundhung/conform' }, - ], - }, - { - title: 'Guides', - links: [ - { title: 'Validation', to: '/validation' }, - { title: 'Nested object and Array', to: '/complex-structures' }, - { title: 'Intent button', to: '/intent-button' }, - { title: 'Accessibility', to: '/accessibility' }, - { title: 'Checkbox and Radio Group', to: '/checkbox-and-radio-group' }, - { title: 'File Upload', to: '/file-upload' }, - ], - }, - { - title: 'Integration', - links: [ - { title: 'UI Libraries', to: '/integration/ui-libraries' }, - { title: 'Remix', to: '/integration/remix' }, - { title: 'Next.js', to: '/integration/nextjs' }, - ], - }, - { - title: 'API Reference', - links: [ - { title: 'useForm', to: '/api/react/useForm' }, - { title: 'useField', to: '/api/react/useField' }, - { title: 'useFormMetadata', to: '/api/react/useFormMetadata' }, - { title: 'useInputControl', to: '/api/react/useInputControl' }, - { title: 'FormProvider', to: '/api/react/FormProvider' }, - { title: 'FormStateInput', to: '/api/react/FormStateInput' }, - ], - }, - { - title: 'Utilities', - links: [ - { title: 'getFormProps', to: '/api/react/getFormProps' }, - { title: 'getFieldsetProps', to: '/api/react/getFieldsetProps' }, - { title: 'getInputProps', to: '/api/react/getInputProps' }, - { title: 'getSelectProps', to: '/api/react/getSelectProps' }, - { title: 'getTextareaProps', to: '/api/react/getTextareaProps' }, - { title: 'getCollectionProps', to: '/api/react/getCollectionProps' }, - ], - }, - { - title: 'Schema related', - links: [ - { title: 'parseWithZod', to: '/api/zod/parseWithZod' }, - { title: 'parseWithYup', to: '/api/yup/parseWithYup' }, - { title: 'getZodConstraint', to: '/api/zod/getZodConstraint' }, - { title: 'getYupConstraint', to: '/api/yup/getYupConstraint' }, - ], - }, -]; +const menus: { [code: string]: Menu[] } = { + en: [ + { + title: 'Getting Started', + links: [ + { title: 'Overview', to: '/' }, + { title: 'Tutorial', to: '/tutorial' }, + { title: 'Upgrading to v1', to: '/upgrading-v1' }, + { title: 'GitHub', to: 'https://github.com/edmundhung/conform' }, + ], + }, + { + title: 'Guides', + links: [ + { title: 'Validation', to: '/validation' }, + { title: 'Nested object and Array', to: '/complex-structures' }, + { title: 'Intent button', to: '/intent-button' }, + { title: 'Accessibility', to: '/accessibility' }, + { title: 'Checkbox and Radio Group', to: '/checkbox-and-radio-group' }, + { title: 'File Upload', to: '/file-upload' }, + ], + }, + { + title: 'Integration', + links: [ + { title: 'UI Libraries', to: '/integration/ui-libraries' }, + { title: 'Remix', to: '/integration/remix' }, + { title: 'Next.js', to: '/integration/nextjs' }, + ], + }, + { + title: 'API Reference', + links: [ + { title: 'useForm', to: '/api/react/useForm' }, + { title: 'useField', to: '/api/react/useField' }, + { title: 'useFormMetadata', to: '/api/react/useFormMetadata' }, + { title: 'useInputControl', to: '/api/react/useInputControl' }, + { title: 'FormProvider', to: '/api/react/FormProvider' }, + { title: 'FormStateInput', to: '/api/react/FormStateInput' }, + ], + }, + { + title: 'Utilities', + links: [ + { title: 'getFormProps', to: '/api/react/getFormProps' }, + { title: 'getFieldsetProps', to: '/api/react/getFieldsetProps' }, + { title: 'getInputProps', to: '/api/react/getInputProps' }, + { title: 'getSelectProps', to: '/api/react/getSelectProps' }, + { title: 'getTextareaProps', to: '/api/react/getTextareaProps' }, + { title: 'getCollectionProps', to: '/api/react/getCollectionProps' }, + ], + }, + { + title: 'Schema related', + links: [ + { title: 'parseWithZod', to: '/api/zod/parseWithZod' }, + { title: 'parseWithYup', to: '/api/yup/parseWithYup' }, + { title: 'getZodConstraint', to: '/api/zod/getZodConstraint' }, + { title: 'getYupConstraint', to: '/api/yup/getYupConstraint' }, + ], + }, + ], + ja: [ + { + title: 'はじめに', + links: [ + { title: '概要', to: '/' }, + { title: 'チュートリアル', to: '/tutorial' }, + { title: 'v1 へのアップグレード', to: '/upgrading-v1' }, + { title: 'GitHub', to: 'https://github.com/edmundhung/conform' }, + ], + }, + { + title: 'ガイド', + links: [ + { title: 'バリデーション', to: '/validation' }, + { title: 'ネストされたオブジェクトと配列', to: '/complex-structures' }, + { title: 'インテントボタン', to: '/intent-button' }, + { title: 'アクセシビリティ', to: '/accessibility' }, + { + title: 'チェックボックスとラジオグループ', + to: '/checkbox-and-radio-group', + }, + { title: 'ファイルのアップロード', to: '/file-upload' }, + ], + }, + { + title: 'インテグレーション', + links: [ + { title: 'UI ライブラリ', to: '/integration/ui-libraries' }, + { title: 'Remix', to: '/integration/remix' }, + { title: 'Next.js', to: '/integration/nextjs' }, + ], + }, + { + title: 'API リファレンス', + links: [ + { title: 'useForm', to: '/api/react/useForm' }, + { title: 'useField', to: '/api/react/useField' }, + { title: 'useFormMetadata', to: '/api/react/useFormMetadata' }, + { title: 'useInputControl', to: '/api/react/useInputControl' }, + { title: 'FormProvider', to: '/api/react/FormProvider' }, + { title: 'FormStateInput', to: '/api/react/FormStateInput' }, + ], + }, + { + title: 'ユーティリティ', + links: [ + { title: 'getFormProps', to: '/api/react/getFormProps' }, + { title: 'getFieldsetProps', to: '/api/react/getFieldsetProps' }, + { title: 'getInputProps', to: '/api/react/getInputProps' }, + { title: 'getSelectProps', to: '/api/react/getSelectProps' }, + { title: 'getTextareaProps', to: '/api/react/getTextareaProps' }, + { title: 'getCollectionProps', to: '/api/react/getCollectionProps' }, + ], + }, + { + title: 'スキーマ関連', + links: [ + { title: 'parseWithZod', to: '/api/zod/parseWithZod' }, + { title: 'parseWithYup', to: '/api/yup/parseWithYup' }, + { title: 'getZodConstraint', to: '/api/zod/getZodConstraint' }, + { title: 'getYupConstraint', to: '/api/yup/getYupConstraint' }, + ], + }, + ], +}; export function Guide({ children, }: { children: React.ReactNode; }): React.ReactNode { - const { owner, repo, ref } = useRootLoaderData(); + const { owner, repo, ref, language } = useRootLoaderData(); const { file, toc } = usePageLoaderData() ?? {}; const location = useLocation(); @@ -106,16 +172,30 @@ export function Guide({ return (
-
+
{logo} +
- +
{children}