-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(intlayer-core): fix array intlayer
- Loading branch information
1 parent
9115caa
commit fb3794e
Showing
16 changed files
with
541 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { type IConfigLocales, getTranslationContent } from 'intlayer'; | ||
import type { Metadata } from 'next'; | ||
import type { LocalParams } from 'next-intlayer'; | ||
|
||
export const generateMetadata = ({ | ||
params: { locale }, | ||
}: LocalParams): Metadata => { | ||
const t = <T>(content: IConfigLocales<T>) => | ||
getTranslationContent(content, locale); | ||
|
||
return { | ||
title: t<string>({ | ||
en: 'Intlayer | Documentation', | ||
fr: 'Intlayer | Documentation', | ||
es: 'Intlayer | Documentación', | ||
}), | ||
description: t<string>({ | ||
en: 'Transform your website into a multilingual application in 2 minutes. Discover the full range of Intlayer features through this online documentation.', | ||
fr: "Transformez votre site web en application multilingue en 2 minutes. Découvrez l'ensemble des fonctionnalités de Intlayer à travers cette documentation en ligne.", | ||
es: 'Transforme su sitio web en una aplicación multilingüe en 2 minutos. Descubra todas las funcionalidades de Intlayer a través de esta documentación en línea.', | ||
}), | ||
generator: undefined, | ||
keywords: t<string[]>({ | ||
en: [ | ||
'Documentation', | ||
'Internationalization', | ||
'Intlayer', | ||
'Next.js', | ||
'JavaScript', | ||
'React', | ||
], | ||
fr: [ | ||
'Documentation', | ||
'Internationalisation', | ||
'Intlayer', | ||
'Next.js', | ||
'JavaScript', | ||
'React', | ||
], | ||
es: [ | ||
'Documentation', | ||
'Internacionalización', | ||
'Intlayer', | ||
'Next.js', | ||
'JavaScript', | ||
'React', | ||
], | ||
}), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DocPage } from '@components/DocPage'; | ||
import { DocPageLayout } from '@components/DocPage/DocPageLayout'; | ||
import { PageLayout } from '@layouts/PageLayout'; | ||
import type { NextPageIntlayer } from 'next-intlayer'; | ||
import { generateMetadata } from './metadata'; | ||
|
||
export { generateMetadata }; | ||
|
||
const Page: NextPageIntlayer = ({ params: { locale } }) => ( | ||
<PageLayout locale={locale} editorEnabled={false}> | ||
<DocPageLayout> | ||
<DocPage /> | ||
</DocPageLayout> | ||
</PageLayout> | ||
); | ||
export default Page; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
'use client'; | ||
|
||
import { Container } from '@intlayer/design-system'; | ||
import { cn } from '@utils/cn'; | ||
import { usePathname, useRouter } from 'next/navigation'; | ||
import { useIntlayer } from 'next-intlayer'; | ||
import type { FC, ReactNode } from 'react'; | ||
|
||
type DocPageLayoutProps = { | ||
children?: ReactNode; | ||
}; | ||
|
||
export const DocPageLayout: FC<DocPageLayoutProps> = ({ children }) => { | ||
const { navbar } = useIntlayer('doc-page'); | ||
const pathname = usePathname(); | ||
const router = useRouter(); | ||
|
||
return ( | ||
<div className="flex size-full border-b-[0.5px]"> | ||
<Container | ||
className="h-full flex-none" | ||
roundedSize="none" | ||
transparency="sm" | ||
> | ||
<nav className="flex flex-col gap-5 px-6 py-10"> | ||
{navbar.map((section1) => ( | ||
<div key={section1.title.value}> | ||
<button | ||
className={cn([ | ||
'text-neutral hover:text-text dark:hover:text-text-dark cursor-pointer font-semibold transition-colors dark:text-neutral-200', | ||
section1.url?.value === pathname, | ||
])} | ||
onClick={() => | ||
typeof section1.url?.value === 'string' && | ||
router.push(section1.url.value) | ||
} | ||
> | ||
{section1.title} | ||
</button> | ||
|
||
{section1.subSections && section1.subSections.length > 0 && ( | ||
<div className="border-neutral dark:border-neutral-dark mt-4 flex flex-col gap-4 border-l-[0.5px] p-1"> | ||
{section1.subSections.map((section2) => ( | ||
<div key={section2.title.value}> | ||
<button | ||
className={cn([ | ||
'text-neutral hover:text-text dark:hover:text-text-dark cursor-pointer p-2 text-sm transition-colors dark:text-neutral-200', | ||
section2.url?.value === pathname, | ||
])} | ||
onClick={() => | ||
typeof section2.url.value === 'string' && | ||
router.push(section2.url.value) | ||
} | ||
> | ||
{section2.title} | ||
</button> | ||
|
||
{section2.subSections && | ||
section2.subSections.length > 0 && ( | ||
<div className="text-neutral hover:text-text dark:hover:text-text-dark border-neutral dark:border-neutral-dark flex flex-col items-start gap-2 border-l-[0.5px] p-1 transition-colors"> | ||
{section2.subSections.map((section3) => ( | ||
<button | ||
className={cn([ | ||
'text-neutral hover:text-text dark:hover:text-text-dark cursor-pointer p-2 text-xs transition-colors dark:text-neutral-200', | ||
section3.url?.value === pathname, | ||
])} | ||
key={section3.title.value} | ||
onClick={() => | ||
typeof section3.url.value === 'string' && | ||
router.push(section3.url.value) | ||
} | ||
> | ||
{section3.title} | ||
</button> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
))} | ||
</nav> | ||
</Container> | ||
<div className="grow">{children}</div> | ||
</div> | ||
); | ||
}; |
123 changes: 123 additions & 0 deletions
123
apps/website/src/components/DocPage/doc-page.content.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import { type DeclarationContent, t } from 'intlayer'; | ||
import { PagesRoutes } from '@/Routes'; | ||
|
||
type NavLink = { | ||
title: string; | ||
subSections?: NavLink[]; | ||
url?: string; | ||
}; | ||
|
||
type NavbarContent = { | ||
navbar: NavLink[]; | ||
}; | ||
|
||
export const navbarContent: DeclarationContent<NavbarContent> = { | ||
id: 'doc-page', | ||
navbar: [ | ||
{ | ||
title: t({ fr: 'Commencez', en: 'Get started', es: 'Comenzar' }), | ||
url: PagesRoutes.Doc_GetStarted, | ||
subSections: [], | ||
}, | ||
{ | ||
title: t({ fr: 'Concept', en: 'Concept', es: 'Concepto' }), | ||
subSections: [ | ||
{ | ||
title: t({ | ||
fr: 'Configuration', | ||
en: 'Configuration', | ||
es: 'Configuración', | ||
}), | ||
url: PagesRoutes.Doc_Configuration, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Intérêt de intlayer', | ||
en: 'Interest of intlayer', | ||
es: 'Interés de intlayer', | ||
}), | ||
url: PagesRoutes.Doc_Interest, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Éditeur Intlayer', | ||
en: 'Intlayer editor', | ||
es: 'Editor de Intlayer', | ||
}), | ||
url: PagesRoutes.Doc_IntlayerEditor, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Déclaration de contenu', | ||
en: 'Content declaration', | ||
es: 'Declaración de contenido', | ||
}), | ||
url: PagesRoutes.Doc_ContentDeclaration, | ||
subSections: [ | ||
{ | ||
title: t({ | ||
fr: 'Traduction', | ||
en: 'Translation', | ||
es: 'Traducción', | ||
}), | ||
url: PagesRoutes.Doc_ContentDeclaration_Translation, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Énumération', | ||
en: 'Enumeration', | ||
es: 'Enumeración', | ||
}), | ||
url: PagesRoutes.Doc_ContentDeclaration_Enumeration, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Récupération de fonction', | ||
en: 'Function fetching', | ||
es: 'Obtención de función', | ||
}), | ||
url: PagesRoutes.Doc_ContentDeclaration_FunctionFetching, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'ID imbriqué', | ||
en: 'Nested ID', | ||
es: 'ID anidado', | ||
}), | ||
url: PagesRoutes.Doc_ContentDeclaration_NestedId, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
title: t({ fr: 'Environnements', en: 'Environments', es: 'Entornos' }), | ||
subSections: [ | ||
{ | ||
title: t({ | ||
fr: 'Intlayer avec NextJS', | ||
en: 'Intlayer with NextJS', | ||
es: 'Intlayer con NextJS', | ||
}), | ||
url: PagesRoutes.Doc_Environment_NextJS, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Intlayer avec React (CRA)', | ||
en: 'Intlayer with React (CRA)', | ||
es: 'Intlayer con React (CRA)', | ||
}), | ||
url: PagesRoutes.Doc_Environment_CRA, | ||
}, | ||
{ | ||
title: t({ | ||
fr: 'Intlayer avec ViteJS+React', | ||
en: 'Intlayer with ViteJS+React', | ||
es: 'Intlayer con ViteJS+React', | ||
}), | ||
url: PagesRoutes.Doc_Environment_ViteAndReact, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { FC } from 'react'; | ||
|
||
export const DocPage: FC = () => { | ||
return <></>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.