mirror of
https://github.com/theoludwig/theoludwig.git
synced 2024-11-05 13:01:30 +01:00
Théo LUDWIG
6b29ce9b15
Improvements: - Hide switch theme input (ugly little white square) - i18n without subpath (e.g: /fr or /en), same url whatever the locale used
31 lines
665 B
TypeScript
31 lines
665 B
TypeScript
import Image from 'next/image'
|
|
|
|
import type { CookiesStore } from '@/i18n/i18n.client'
|
|
import { useI18n } from '@/i18n/i18n.client'
|
|
|
|
export interface LocaleFlagProps {
|
|
locale: string
|
|
cookiesStore: CookiesStore
|
|
}
|
|
|
|
export const LocaleFlag: React.FC<LocaleFlagProps> = (props) => {
|
|
const { locale, cookiesStore } = props
|
|
|
|
const i18n = useI18n(cookiesStore)
|
|
|
|
return (
|
|
<>
|
|
<Image
|
|
quality={100}
|
|
width={35}
|
|
height={35}
|
|
src={`/images/locales/${locale}.svg`}
|
|
alt={locale}
|
|
/>
|
|
<p data-cy='locale-flag-text' className='mx-2 text-base'>
|
|
{i18n.translate(`common.${locale}`)}
|
|
</p>
|
|
</>
|
|
)
|
|
}
|