Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIXED: Text overflows in the user management card details #9532 #9541

25 changes: 22 additions & 3 deletions src/components/Users/UserListAndCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import { useTranslation } from "react-i18next";
import Card from "@/CAREUI/display/Card";
import CareIcon from "@/CAREUI/icons/CareIcon";

import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";

import { Avatar } from "@/components/Common/Avatar";
import Tabs from "@/components/Common/Tabs";
import SearchInput from "@/components/Form/SearchInput";
Expand Down Expand Up @@ -81,9 +88,21 @@ const getNameAndStatusCard = (
<div className="flex flex-row justify-between gap-x-3">
<div className="flex flex-col">
<div className="flex items-center gap-x-3">
<h1 id={`name-${user.username}`} className="text-base font-bold">
{formatName(user)}
</h1>
<TooltipProvider delayDuration={200}>
<Tooltip>
<TooltipTrigger asChild>
<h1
id={`name-${user.username}`}
className="text-base font-bold truncate max-w-[200px]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use rem values over pixels. pixels can behave differently on different DPIs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

>
{formatName(user)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

The tooltip works, however the long name is still displayed; issue isn't solved.

Copy link
Author

@piyushyadav0191 piyushyadav0191 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either, I can truncate or can decide some width or height to that popover

Copy link
Contributor

@Jacobjeevan Jacobjeevan Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either, I can truncate or can decide some width or height to that popover

Truncate the name on the card (Tooltip trigger). Tooltip Content is fine.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

</h1>
</TooltipTrigger>
<TooltipContent>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest a bit more styling to the tooltip content. Check the tooltip for Occupancy Badge in Facility for instance:

image

Copy link
Author

@piyushyadav0191 piyushyadav0191 Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I just added more styling and dynamic transitions on state and side. @Jacobjeevan

<p>{formatName(user)}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<div
className={classNames(
"flex items-center gap-2 rounded-full px-3 py-1",
Expand Down