-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from andostronaut/develop
feat: translate resume and setup intl
- Loading branch information
Showing
18 changed files
with
475 additions
and
75 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
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,84 @@ | ||
import type { Metadata } from 'next' | ||
|
||
import Navbar from '@/components/navbar' | ||
import { ThemeProvider } from '@/components/theme-provider' | ||
import { TooltipProvider } from '@/components/ui/tooltip' | ||
|
||
import { I18nProviderClient } from '@/locales/lib/client' | ||
|
||
import { DATA } from '@/data/resume' | ||
|
||
type MetadataProps = { | ||
params: { locale: string } | ||
} | ||
|
||
export const generateMetadata = async ({ | ||
params, | ||
}: MetadataProps): Promise<Metadata> => { | ||
const locale = params.locale | ||
|
||
return { | ||
metadataBase: new URL(DATA.url), | ||
title: { | ||
default: DATA.name, | ||
template: `%s | ${DATA.name}`, | ||
}, | ||
description: DATA.description, | ||
keywords: DATA.keywords, | ||
openGraph: { | ||
title: `${DATA.name}`, | ||
description: DATA.description, | ||
url: DATA.url, | ||
siteName: `${DATA.name}`, | ||
locale: locale, | ||
type: 'website', | ||
}, | ||
robots: { | ||
index: true, | ||
follow: true, | ||
googleBot: { | ||
index: true, | ||
follow: true, | ||
'max-video-preview': -1, | ||
'max-image-preview': 'large', | ||
'max-snippet': -1, | ||
}, | ||
}, | ||
twitter: { | ||
title: `${DATA.name}`, | ||
card: 'summary_large_image', | ||
}, | ||
verification: { | ||
google: '', | ||
yandex: '', | ||
}, | ||
} | ||
} | ||
|
||
const SubLayout = ({ | ||
children, | ||
params: { locale }, | ||
}: Readonly<{ | ||
children: React.ReactNode | ||
params: { locale: string } | ||
}>) => { | ||
return ( | ||
<ThemeProvider | ||
attribute="class" | ||
defaultTheme="system" | ||
enableSystem | ||
disableTransitionOnChange | ||
> | ||
<I18nProviderClient locale={locale}> | ||
<TooltipProvider delayDuration={0}> | ||
<main className="max-w-2xl mx-auto py-12 sm:py-24 px-6"> | ||
{children} | ||
</main> | ||
<Navbar /> | ||
</TooltipProvider> | ||
</I18nProviderClient> | ||
</ThemeProvider> | ||
) | ||
} | ||
|
||
export default SubLayout |
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 |
---|---|---|
@@ -1,77 +1,34 @@ | ||
import './globals.css' | ||
import '@/app/globals.css' | ||
|
||
import type { Metadata } from 'next' | ||
import { Inter as FontSans } from 'next/font/google' | ||
|
||
import Navbar from '@/components/navbar' | ||
import { ThemeProvider } from '@/components/theme-provider' | ||
import { TooltipProvider } from '@/components/ui/tooltip' | ||
|
||
import { DATA } from '@/data/resume' | ||
import { Inter } from 'next/font/google' | ||
import { cookies } from 'next/headers' | ||
|
||
import { cn } from '@/lib/utils' | ||
|
||
const fontSans = FontSans({ | ||
const inter = Inter({ | ||
subsets: ['latin'], | ||
variable: '--font-sans', | ||
}) | ||
|
||
export const metadata: Metadata = { | ||
metadataBase: new URL(DATA.url), | ||
title: { | ||
default: DATA.name, | ||
template: `%s | ${DATA.name}`, | ||
}, | ||
description: DATA.description, | ||
openGraph: { | ||
title: `${DATA.name}`, | ||
description: DATA.description, | ||
url: DATA.url, | ||
siteName: `${DATA.name}`, | ||
locale: 'en_US', | ||
type: 'website', | ||
}, | ||
robots: { | ||
index: true, | ||
follow: true, | ||
googleBot: { | ||
index: true, | ||
follow: true, | ||
'max-video-preview': -1, | ||
'max-image-preview': 'large', | ||
'max-snippet': -1, | ||
}, | ||
}, | ||
twitter: { | ||
title: `${DATA.name}`, | ||
card: 'summary_large_image', | ||
}, | ||
verification: { | ||
google: '', | ||
yandex: '', | ||
}, | ||
} | ||
|
||
export default function RootLayout({ | ||
const RootLayout = ({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode | ||
}>) { | ||
}>) => { | ||
const locale = cookies().get('Next-Locale')?.value || 'en' | ||
|
||
return ( | ||
<html lang="en" suppressHydrationWarning> | ||
<html lang={locale} suppressHydrationWarning> | ||
<body | ||
className={cn( | ||
'min-h-screen bg-background font-sans antialiased max-w-2xl mx-auto py-12 sm:py-24 px-6', | ||
fontSans.variable | ||
'min-h-screen bg-background font-sans antialiased', | ||
inter.variable | ||
)} | ||
> | ||
<ThemeProvider attribute="class" defaultTheme="dark"> | ||
<TooltipProvider delayDuration={0}> | ||
{children} | ||
<Navbar /> | ||
</TooltipProvider> | ||
</ThemeProvider> | ||
{children} | ||
</body> | ||
</html> | ||
) | ||
} | ||
|
||
export default RootLayout |
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,60 @@ | ||
'use client' | ||
|
||
import { CheckIcon, LanguagesIcon } from 'lucide-react' | ||
|
||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuShortcut, | ||
DropdownMenuTrigger, | ||
} from '@/components/ui/dropdown-menu' | ||
import { Button } from '@/components/ui/button' | ||
|
||
import { useChangeLocale, useCurrentLocale } from '@/locales/lib/client' | ||
|
||
const locales = [ | ||
{ | ||
name: 'English', | ||
value: 'en', | ||
}, | ||
{ | ||
name: 'French', | ||
value: 'fr', | ||
}, | ||
] | ||
|
||
export const LocalToggle = () => { | ||
const changeLocale = useChangeLocale({ preserveSearchParams: true }) | ||
const currentLocale = useCurrentLocale() | ||
|
||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button variant="ghost" size="sm"> | ||
<div className="flex items-center gap-2"> | ||
<LanguagesIcon className="h-5 w-5" /> | ||
<span className="block lg:hidden">{currentLocale}</span> | ||
</div> | ||
<span className="sr-only">Change Locale</span> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent align="end"> | ||
{locales.map((locale) => ( | ||
<DropdownMenuItem | ||
key={locale.value} | ||
onClick={() => changeLocale(locale.value as typeof currentLocale)} | ||
disabled={locale.value === currentLocale} | ||
> | ||
<span>{locale.name}</span> | ||
{locale.value === currentLocale ? ( | ||
<DropdownMenuShortcut> | ||
<CheckIcon className="h-4 w-4" /> | ||
</DropdownMenuShortcut> | ||
) : null} | ||
</DropdownMenuItem> | ||
))} | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
) | ||
} |
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.