fix: long name style changed

This commit is contained in:
shuai 2023-08-28 10:47:50 +08:00
parent 46f2e7b807
commit 8f471d96e9
5 changed files with 19 additions and 7 deletions

View File

@ -12,6 +12,7 @@ interface Props {
avatarSearchStr?: string;
className?: string;
avatarClass?: string;
nameMaxWidth?: string;
}
const Index: FC<Props> = ({
@ -22,11 +23,14 @@ const Index: FC<Props> = ({
className = 'small',
avatarSearchStr = 's=48',
showReputation = true,
nameMaxWidth = '300px',
}) => {
return (
<div className={`d-flex align-items-center text-secondary ${className}`}>
{data?.status !== 'deleted' ? (
<Link to={`/users/${data?.username}`}>
<Link
to={`/users/${data?.username}`}
className="d-flex align-items-center">
{showAvatar && (
<Avatar
avatar={data?.avatar}
@ -36,7 +40,9 @@ const Index: FC<Props> = ({
alt={data?.display_name}
/>
)}
<span className="me-1 text-truncate-1" style={{ maxWidth: '300px' }}>
<span
className="me-1 name-ellipsis"
style={{ maxWidth: nameMaxWidth }}>
{data?.display_name}
</span>
</Link>
@ -51,9 +57,7 @@ const Index: FC<Props> = ({
alt={data?.display_name}
/>
)}
<span className="me-1 text-truncate-1" style={{ maxWidth: '300px' }}>
{data?.display_name}
</span>
<span className="me-1 name-ellipsis">{data?.display_name}</span>
</>
)}

View File

@ -141,6 +141,13 @@ img[src=""] {
}
}
.name-ellipsis {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.text-truncate-1,
.text-truncate-2,
.text-truncate-3,

View File

@ -155,7 +155,7 @@ const Answers: FC = () => {
<td>{li.vote_count}</td>
<td>
<Stack>
<BaseUserCard data={li.user_info} />
<BaseUserCard data={li.user_info} nameMaxWidth="200px" />
<FormatTime
className="small text-secondary"

View File

@ -160,7 +160,7 @@ const Questions: FC = () => {
</td>
<td>
<Stack>
<BaseUserCard data={li.user_info} />
<BaseUserCard data={li.user_info} nameMaxWidth="130px" />
<FormatTime
className="small text-secondary"
time={li.create_time}

View File

@ -254,6 +254,7 @@ const Users: FC = () => {
avatarSearchStr="s=48"
avatarClass="me-2"
showReputation={false}
nameMaxWidth="160px"
/>
</td>
<td>{formatCount(user.rank)}</td>