import { Gender } from 'tuikit-atomicx-react/chat'; import { useUIKit } from '@tencentcloud/uikit-base-component-react'; import { SearchType } from '../../../../../types/search'; import { birthdayToAge, highlightText } from '../../../../../utils'; import { Avatar } from 'tuikit-atomicx-react/chat'; import styles from './User.module.scss'; import type { ResultItemProps } from '../../../../../types/search'; export function User({ data, keyword, onClick }: ResultItemProps) { const { profile } = data; const { t } = useUIKit(); const getGenderText = (gender?: string) => { switch (gender) { case Gender.Male: return t('Search.Male'); case Gender.Female: return t('Search.Female'); default: return t('Search.Secret'); } }; return (
onClick?.(data, SearchType.USER)}>
{profile?.selfSignature ? (
) : (
{getGenderText(profile?.gender)}   {profile?.birthday && `${birthdayToAge(profile.birthday)}${t('Search.Years Old')}`}
)}
); } export default User;