-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
124 additions
and
2 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,48 @@ | ||
import { createStyles } from 'antd-style'; | ||
import classNames from 'classnames'; | ||
import { ReactNode } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import Header from '@/components/Header'; | ||
import ListItem from '@/components/ListItem'; | ||
import { GenderEnum } from '@/types/agent'; | ||
|
||
const useStyles = createStyles(({ css, token }) => ({ | ||
item: css` | ||
position: relative; | ||
width: 180px; | ||
margin-block: 2px; | ||
border-radius: ${token.borderRadius}px; | ||
`, | ||
})); | ||
|
||
interface IndexProps { | ||
currentGender: GenderEnum; | ||
genderOptions: { icon: ReactNode; label: string; value: GenderEnum }[]; | ||
setCurrentGender: (area: GenderEnum) => void; | ||
} | ||
|
||
const Index = (props: IndexProps) => { | ||
const { styles } = useStyles(); | ||
const { currentGender, setCurrentGender, genderOptions = [] } = props; | ||
const { t } = useTranslation(['panel']); | ||
|
||
return ( | ||
<Flexbox> | ||
<Header title={t('info.genderLabel')} /> | ||
{genderOptions.map((item) => ( | ||
<ListItem | ||
avatar={item.icon} | ||
className={classNames(styles.item)} | ||
active={item.value === currentGender} | ||
key={item.value} | ||
title={item.label} | ||
onClick={() => setCurrentGender(item.value)} | ||
/> | ||
))} | ||
</Flexbox> | ||
); | ||
}; | ||
|
||
export default Index; |
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,67 @@ | ||
import { ManOutlined, QuestionCircleOutlined, WomanOutlined } from '@ant-design/icons'; | ||
import { createStyles } from 'antd-style'; | ||
import classNames from 'classnames'; | ||
import React, { memo, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { GenderEnum } from '@/types/agent'; | ||
|
||
import SideBar from './SideBar'; | ||
|
||
const useStyles = createStyles(({ css, token }) => ({ | ||
container: css` | ||
position: relative; | ||
display: flex; | ||
width: 100%; | ||
min-height: 480px; | ||
padding: 0 16px; | ||
background-color: rgba(255, 255, 255, 2%); | ||
border-radius: ${token.borderRadius}px; | ||
`, | ||
})); | ||
|
||
interface TouchProps { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
} | ||
|
||
const Touch = (props: TouchProps) => { | ||
const { style, className } = props; | ||
const { styles } = useStyles(); | ||
const [currentGender, setCurrentGender] = useState<GenderEnum>(GenderEnum.FEMALE); | ||
|
||
const { t } = useTranslation(['constants']); | ||
|
||
const GENDER_OPTIONS = [ | ||
{ | ||
label: t('agent.gender.female'), | ||
value: GenderEnum.FEMALE, | ||
icon: <WomanOutlined style={{ fontSize: 24 }} />, | ||
}, | ||
{ | ||
label: t('agent.gender.male'), | ||
value: GenderEnum.MALE, | ||
icon: <ManOutlined style={{ fontSize: 24 }} />, | ||
}, | ||
{ | ||
label: t('agent.gender.other'), | ||
value: GenderEnum.OTHER, | ||
icon: <QuestionCircleOutlined style={{ fontSize: 24 }} />, | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className={classNames(className, styles.container)} style={style}> | ||
<SideBar | ||
currentGender={currentGender} | ||
setCurrentGender={setCurrentGender} | ||
genderOptions={GENDER_OPTIONS} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default memo(Touch); |
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
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
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