_header.tsx 731 B

123456789101112131415161718192021222324252627282930
  1. 'use client'
  2. import React from 'react'
  3. import style from './page.module.css'
  4. import Select, { LOCALES } from '@/app/components/base/select/locale'
  5. import { type Locale } from '@/i18n'
  6. import I18n from '@/context/i18n'
  7. import { setLocaleOnClient } from '@/i18n/client'
  8. import { useContext } from 'use-context-selector'
  9. type IHeaderProps = {
  10. locale: string
  11. }
  12. const Header = () => {
  13. const { locale, setLocaleOnClient } = useContext(I18n)
  14. return <div className='flex items-center justify-between p-6 w-full'>
  15. <div className={style.logo}></div>
  16. <Select
  17. value={locale}
  18. items={LOCALES}
  19. onChange={(value) => {
  20. setLocaleOnClient(value as Locale)
  21. }}
  22. />
  23. </div>
  24. }
  25. export default Header