Skip to content

Commit

Permalink
Added tooltip for list items
Browse files Browse the repository at this point in the history
  • Loading branch information
tulsiojha committed Mar 7, 2024
1 parent f3f1245 commit 7504052
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 28 deletions.
87 changes: 62 additions & 25 deletions src/apps/console/components/console-list-components.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from 'react';
import { ReactNode, forwardRef } from 'react';
import Tooltip from '~/components/atoms/tooltip';
import { cn } from '~/components/utils';

Expand Down Expand Up @@ -72,16 +72,37 @@ const ListItem = ({
return (
<div className={cn(BaseStyle, className)}>
<div className="flex flex-col flex-1 truncate">
{data && (
<div className="flex-1 bodyMd-medium text-text-strong truncate pulsable">
{data}
</div>
)}
{subtitle && (
<div className="pulsable bodyMd text-text-soft truncate">
{subtitle}
<Tooltip.Root
className="!w-fit !max-w-fit"
side="top"
content={
<div className="flex flex-col flex-1 truncate">
{data && (
<div className="flex-1 bodyMd-medium text-text-strong truncate pulsable">
{data}
</div>
)}
{subtitle && (
<div className="pulsable bodyMd text-text-soft truncate">
{subtitle}
</div>
)}
</div>
}
>
<div className="flex flex-col gap-sm truncate max-w-full w-fit">
{data && (
<div className="flex-1 bodyMd-medium text-text-strong truncate pulsable">
{data}
</div>
)}
{subtitle && (
<div className="pulsable bodyMd text-text-soft truncate">
{subtitle}
</div>
)}
</div>
)}
</Tooltip.Root>
</div>
{action}
</div>
Expand All @@ -106,23 +127,39 @@ const ListTitle = ({
<div className="flex flex-row items-center gap-xl flex-1 truncate">
{avatar}
<div className="flex flex-col gap-sm flex-1 truncate">
{title && (
<div className="bodyMd-semibold text-text-default truncate pulsable">
<Tooltip.Root
className="!w-fit !max-w-fit"
side="top"
content={<div className="bodySm text-text-strong">{title}</div>}
>
<span className="w-fit">{title}</span>
</Tooltip.Root>
</div>
)}
<Tooltip.Root
className="!w-fit !max-w-fit"
side="top"
content={
<div className="flex flex-col gap-sm w-fit truncate">
{title && (
<div className="bodyMd-semibold text-text-default truncate pulsable">
<span className="w-fit">{title}</span>
</div>
)}

{subtitle && (
<div className="bodySm text-text-soft truncate pulsable">
{subtitle}
{subtitle && (
<div className="bodySm text-text-soft truncate pulsable">
{subtitle}
</div>
)}
</div>
}
>
<div className="flex flex-col gap-sm truncate max-w-full w-fit">
{title && (
<div className="bodyMd-semibold text-text-default pulsable truncate">
<span>{title}</span>
</div>
)}

{subtitle && (
<div className="bodySm text-text-soft truncate pulsable">
{subtitle}
</div>
)}
</div>
)}
</Tooltip.Root>
</div>
</div>
{action}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import { Link, useOutletContext, useParams } from '@remix-run/react';
import { generateKey, titleCase } from '~/components/utils';
import ConsoleAvatar from '~/console/components/console-avatar';
import {
ListBody,
ListItem,
ListTitle,
listClass,
listFlex,
} from '~/console/components/console-list-components';
import Grid from '~/console/components/grid';
import ListGridView from '~/console/components/list-grid-view';
Expand Down

0 comments on commit 7504052

Please sign in to comment.