'use client';
import type { FC, PropsWithChildren } from 'react';

import { createContext, useState } from 'react';

import type { contextType, loacalType } from './type';
export const locales: loacalType[] = [
    {
        name: 'en_US',
        label: '🇺🇸 english(US)',
    },
    {
        name: 'zh_CN',
        label: '🇨🇳 简体中文',
    },
];

export const LoacalContext = createContext<contextType>({
    local: locales[0],
    setLocal: (_local) => {},
});
export const LoacalProvider: FC<PropsWithChildren> = ({ children }) => {
    const [locals, setLocals] = useState<loacalType>(locales[0]);
    return <LoacalContext value={{ local: locals, setLocal: setLocals }}>{children}</LoacalContext>;
};
