feat: Add locale switch
This commit is contained in:
parent
223690a7cf
commit
1b44edbac3
@ -16,6 +16,7 @@ import '../styles/style.scss'
|
|||||||
import '../styles/contents.scss'
|
import '../styles/contents.scss'
|
||||||
import Dimmed from '@/components/ui/Dimmed'
|
import Dimmed from '@/components/ui/Dimmed'
|
||||||
import SessionProvider from './SessionProvider'
|
import SessionProvider from './SessionProvider'
|
||||||
|
import LocaleSwitch from '@/components/LocaleSwitch'
|
||||||
|
|
||||||
// const inter = Inter({ subsets: ['latin'] })
|
// const inter = Inter({ subsets: ['latin'] })
|
||||||
|
|
||||||
@ -76,8 +77,9 @@ export default async function RootLayout({ children }) {
|
|||||||
</QcastProvider>
|
</QcastProvider>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<div className="footer-inner">
|
<div className="footer-inner flex justify-center">
|
||||||
<span>COPYRIGHT©2024 Hanwha Japan All Rights Reserved.</span>
|
<span>COPYRIGHT©2024 Hanwha Japan All Rights Reserved.</span>
|
||||||
|
<LocaleSwitch />
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
23
src/components/LocaleSwitch.jsx
Normal file
23
src/components/LocaleSwitch.jsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { globalLocaleStore } from '@/store/localeAtom'
|
||||||
|
import { useRecoilState } from 'recoil'
|
||||||
|
|
||||||
|
export default function LocaleSwitch() {
|
||||||
|
const [globalLocale, setGlobalLocale] = useRecoilState(globalLocaleStore)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className="locale-switch"
|
||||||
|
onClick={() => {
|
||||||
|
if (globalLocale === 'ko') {
|
||||||
|
setGlobalLocale('ja')
|
||||||
|
} else {
|
||||||
|
setGlobalLocale('ko')
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{globalLocale.toUpperCase()}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1 +1,5 @@
|
|||||||
@import '_main.scss';
|
@import '_main.scss';
|
||||||
|
|
||||||
|
.locale-switch {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user