Skip to content

Commit

Permalink
feat: tooltip portal
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed May 15, 2024
1 parent 92eefce commit 0954864
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
33 changes: 19 additions & 14 deletions src/renderer/src/components/feed-column/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TooltipContent,
TooltipProvider,
TooltipTrigger,
TooltipPortal,
} from "@renderer/components/ui/tooltip"
import { FeedIcon } from "@renderer/components/feed-icon"
import dayjs from "@renderer/lib/dayjs"
Expand Down Expand Up @@ -190,18 +191,20 @@ function FeedCategory({
<TooltipTrigger asChild>
<i className="i-mingcute-wifi-off-line shrink-0 ml-1 text-base" />
</TooltipTrigger>
<TooltipContent>
Error since{" "}
{dayjs
.duration(
dayjs(feed.feeds.errorAt).diff(
dayjs(),
<TooltipPortal>
<TooltipContent>
Error since{" "}
{dayjs
.duration(
dayjs(feed.feeds.errorAt).diff(
dayjs(),
"minute",
),
"minute",
),
"minute",
)
.humanize(true)}
</TooltipContent>
)
.humanize(true)}
</TooltipContent>
</TooltipPortal>
</Tooltip>
</TooltipProvider>
)}
Expand All @@ -211,9 +214,11 @@ function FeedCategory({
<TooltipTrigger asChild>
<i className="i-mingcute-eye-close-line shrink-0 ml-1 text-base" />
</TooltipTrigger>
<TooltipContent>
Not publicly visible on your profile page
</TooltipContent>
<TooltipPortal>
<TooltipContent>
Not publicly visible on your profile page
</TooltipContent>
</TooltipPortal>
</Tooltip>
</TooltipProvider>
)}
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ const TooltipContent = React.forwardRef<
))
TooltipContent.displayName = TooltipPrimitive.Content.displayName

export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
const TooltipPortal = TooltipPrimitive.Portal

export {
Tooltip,
TooltipTrigger,
TooltipContent,
TooltipProvider,
TooltipPortal,
}

0 comments on commit 0954864

Please sign in to comment.