'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>
  )
}
