style: login page lang select
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
import langConfigMap from '@/locales/lang-config-map';
|
||||||
|
import { GlobalOutlined } from '@ant-design/icons';
|
||||||
|
import { getAllLocales, setLocale } from '@umijs/max';
|
||||||
|
import { Dropdown } from 'antd';
|
||||||
|
import { get } from 'lodash';
|
||||||
|
|
||||||
|
const LangSelect = () => {
|
||||||
|
const allLocals = getAllLocales();
|
||||||
|
const items = allLocals.map((key) => {
|
||||||
|
return {
|
||||||
|
key,
|
||||||
|
label: (
|
||||||
|
<span
|
||||||
|
className="flex flex-center font-size-12"
|
||||||
|
style={{ paddingInline: 8 }}
|
||||||
|
>
|
||||||
|
<span>{get(langConfigMap, [key, 'label'])}</span>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
onClick: () => {
|
||||||
|
setLocale(key, false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown menu={{ items }}>
|
||||||
|
<span style={{ padding: '0 12px', cursor: 'pointer' }}>
|
||||||
|
<GlobalOutlined />
|
||||||
|
</span>
|
||||||
|
</Dropdown>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LangSelect;
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
import LogoIcon from '@/assets/images/gpustack-logo.png';
|
import LogoIcon from '@/assets/images/gpustack-logo.png';
|
||||||
import { initialPasswordAtom, userAtom } from '@/atoms/user';
|
import { initialPasswordAtom, userAtom } from '@/atoms/user';
|
||||||
|
import LangSelect from '@/components/lang-select';
|
||||||
import SealInput from '@/components/seal-form/seal-input';
|
import SealInput from '@/components/seal-form/seal-input';
|
||||||
import {
|
import {
|
||||||
getRememberMe,
|
getRememberMe,
|
||||||
rememberMe,
|
rememberMe,
|
||||||
removeRememberMe
|
removeRememberMe
|
||||||
} from '@/utils/localstore/index';
|
} from '@/utils/localstore/index';
|
||||||
import { GlobalOutlined, LockOutlined, UserOutlined } from '@ant-design/icons';
|
import { LockOutlined, UserOutlined } from '@ant-design/icons';
|
||||||
import { SelectLang, history, useIntl, useModel } from '@umijs/max';
|
import { history, useIntl, useModel } from '@umijs/max';
|
||||||
import { Button, Checkbox, Form } from 'antd';
|
import { Button, Checkbox, Form } from 'antd';
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
@@ -147,10 +148,10 @@ const LoginForm = () => {
|
|||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
padding: '0 20px'
|
padding: '20px'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectLang icon={<GlobalOutlined />} reload={false} />
|
<LangSelect />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Form
|
<Form
|
||||||
|
|||||||
Reference in New Issue
Block a user