-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate user credential list to react component
- Loading branch information
1 parent
88112af
commit 469be25
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Flex from './Flex'; | ||
import { ReloadOutlined } from '@ant-design/icons'; | ||
import { Button, Radio, theme } from 'antd'; | ||
import { useState, useTransition } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
const UserCredentialList: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const { token } = theme.useToken(); | ||
|
||
const [activeType, setActiveType] = useState<'active' | 'inactive'>('active'); | ||
const [isActiveTypePending, startActiveTypeTransition] = useTransition(); | ||
|
||
return ( | ||
<Flex direction="column"> | ||
<Flex | ||
justify="between" | ||
style={{ | ||
width: '100%', | ||
padding: token.paddingContentVertical, | ||
paddingLeft: token.paddingContentHorizontalSM, | ||
paddingRight: token.paddingContentHorizontalSM, | ||
}} | ||
align="start" | ||
> | ||
<Flex gap={token.marginXS} align="start"> | ||
<Radio.Group | ||
value={activeType} | ||
onChange={(value) => { | ||
startActiveTypeTransition(() => { | ||
setActiveType(value.target.value); | ||
}); | ||
// setPaginationState({ | ||
// current: 1, | ||
// pageSize: paginationState.pageSize, | ||
// }); | ||
}} | ||
optionType="button" | ||
buttonStyle="solid" | ||
options={[ | ||
{ | ||
label: t('credential.Active'), | ||
value: 'active', | ||
}, | ||
{ | ||
label: t('credential.Inactive'), | ||
value: 'inactive', | ||
}, | ||
]} | ||
/> | ||
</Flex> | ||
<Flex gap={token.marginXS}> | ||
<Button icon={<ReloadOutlined />} /> | ||
<Button type="primary">{t('credential.AddCredential')}</Button> | ||
</Flex> | ||
</Flex> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default UserCredentialList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters