import { GlobalOutlined } from "@ant-design/icons"; import { Button, ButtonProps, Dropdown, MenuProps, theme } from "antd"; import { useLocale } from "./useLocale"; import { LocaleType } from "./langMp"; import React from "react"; const { useToken } = theme; interface Props extends ButtonProps { children?: React.ReactNode, placement?: "topLeft" | "topCenter" | "topRight" | "bottomLeft" | "bottomCenter" | "bottomRight" | "top" | "bottom", } const LocaleButton = (props: Props) => { const { children, placement, ...otherProps } = props; const { token } = useToken(); const { getLocale, setLocale, availableLang } = useLocale(); const onClick: MenuProps["onClick"] = ({ key }) => { setLocale(key as LocaleType); }; const items: MenuProps["items"] = availableLang.map((lang) => ({ label: ( {lang} ), key: lang, })) items.unshift({ label: ( 中文 ), key: "zh", }); return ( {children ||