style: login form style
This commit is contained in:
+27
-13
@@ -1,8 +1,10 @@
|
||||
import { userAtom } from '@/atoms/user';
|
||||
import useTabActive from '@/hooks/use-tab-active';
|
||||
import { PageContainer } from '@ant-design/pro-components';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { TabsProps } from 'antd';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { useAtom } from 'jotai';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Appearance from './components/appearance';
|
||||
import ModifyPasswordn from './components/modify-password';
|
||||
@@ -15,23 +17,35 @@ const Wrapper = styled.div`
|
||||
|
||||
const Profile: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const [userInfo, setUserInfo] = useAtom(userAtom);
|
||||
const { setTabActive, getTabActive, tabsMap } = useTabActive();
|
||||
const [activeKey, setActiveKey] = useState(
|
||||
getTabActive(tabsMap.userSettings) || 'modify-password'
|
||||
userInfo?.source === 'Local' ? 'modify-password' : 'appearance'
|
||||
);
|
||||
|
||||
const items: TabsProps['items'] = [
|
||||
{
|
||||
key: 'modify-password',
|
||||
label: intl.formatMessage({ id: 'users.form.updatepassword' }),
|
||||
children: <ModifyPasswordn />
|
||||
},
|
||||
{
|
||||
key: 'appearance',
|
||||
label: intl.formatMessage({ id: 'common.appearance' }),
|
||||
children: <Appearance />
|
||||
const items: TabsProps['items'] = useMemo(() => {
|
||||
if (userInfo?.source !== 'Local') {
|
||||
return [
|
||||
{
|
||||
key: 'appearance',
|
||||
label: intl.formatMessage({ id: 'common.appearance' }),
|
||||
children: <Appearance />
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
return [
|
||||
{
|
||||
key: 'modify-password',
|
||||
label: intl.formatMessage({ id: 'users.form.updatepassword' }),
|
||||
children: <ModifyPasswordn />
|
||||
},
|
||||
{
|
||||
key: 'appearance',
|
||||
label: intl.formatMessage({ id: 'common.appearance' }),
|
||||
children: <Appearance />
|
||||
}
|
||||
];
|
||||
}, [userInfo?.source]);
|
||||
|
||||
const handleChangeTab = useCallback((key: string) => {
|
||||
setActiveKey(key);
|
||||
|
||||
Reference in New Issue
Block a user