fix: online text overflow

This commit is contained in:
molvqingtai 2024-10-11 15:50:15 +08:00
parent e8e243ee09
commit d4e42c68ca
3 changed files with 6 additions and 10 deletions

View file

@ -28,7 +28,7 @@ const DanmakuMessage: FC<PromptItemProps> = ({ data, className, onClick, onMouse
<AvatarImage src={data.userAvatar} className="size-full" alt="avatar" /> <AvatarImage src={data.userAvatar} className="size-full" alt="avatar" />
<AvatarFallback>{data.username.at(0)}</AvatarFallback> <AvatarFallback>{data.username.at(0)}</AvatarFallback>
</Avatar> </Avatar>
<div className="max-w-44 overflow-hidden text-ellipsis text-nowrap">{data.body}</div> <div className="max-w-44 truncate">{data.body}</div>
</Button> </Button>
) )
} }

View file

@ -37,9 +37,7 @@ const MessageItem: FC<MessageItemProps> = (props) => {
</Avatar> </Avatar>
<div className="overflow-hidden"> <div className="overflow-hidden">
<div className="grid grid-cols-[1fr_auto] items-center gap-x-2 leading-none"> <div className="grid grid-cols-[1fr_auto] items-center gap-x-2 leading-none">
<div className="overflow-hidden text-ellipsis text-sm font-semibold text-slate-600"> <div className="truncate text-sm font-semibold text-slate-600">{props.data.username}</div>
{props.data.username}
</div>
<FormatDate className="text-xs text-slate-400" date={props.data.date}></FormatDate> <FormatDate className="text-xs text-slate-400" date={props.data.date}></FormatDate>
</div> </div>
<div> <div>

View file

@ -24,7 +24,7 @@ const Header: FC = () => {
</Avatar> </Avatar>
<HoverCard> <HoverCard>
<HoverCardTrigger asChild> <HoverCardTrigger asChild>
<Button className="overflow-hidden" variant="link"> <Button className="overflow-hidden p-2" variant="link">
<span className="truncate text-lg font-semibold text-slate-600"> <span className="truncate text-lg font-semibold text-slate-600">
{siteInfo.hostname.replace(/^www\./i, '')} {siteInfo.hostname.replace(/^www\./i, '')}
</span> </span>
@ -49,8 +49,8 @@ const Header: FC = () => {
</HoverCard> </HoverCard>
<HoverCard> <HoverCard>
<HoverCardTrigger asChild> <HoverCardTrigger asChild>
<Button className="overflow-hidden" variant="link"> <Button className="p-0" variant="link">
<div className="flex items-center gap-x-1 text-nowrap text-sm text-slate-500"> <div className="flex items-center gap-x-1 text-nowrap text-xs text-slate-500">
<span className="relative flex size-2"> <span className="relative flex size-2">
<span <span
className={cn( className={cn(
@ -77,9 +77,7 @@ const Header: FC = () => {
<AvatarImage src={user.userAvatar} alt="avatar" /> <AvatarImage src={user.userAvatar} alt="avatar" />
<AvatarFallback>{user.username.at(0)}</AvatarFallback> <AvatarFallback>{user.username.at(0)}</AvatarFallback>
</Avatar> </Avatar>
<div className="flex-1 overflow-hidden text-ellipsis text-nowrap text-sm text-slate-500"> <div className="flex-1 truncate text-sm text-slate-500">{user.username}</div>
{user.username}
</div>
</div> </div>
))} ))}
</ScrollArea> </ScrollArea>