mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix tooltips (#10154)
* use portal for tooltips * Fix tooltips for desktop and mobile nav bars --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
parent
e7f8bca2c3
commit
dcc0886305
@ -6,6 +6,8 @@ import {
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
import { useState } from "react";
|
||||
import { isDesktop } from "react-device-detect";
|
||||
|
||||
const variants = {
|
||||
primary: {
|
||||
@ -39,9 +41,11 @@ export default function NavItem({
|
||||
}: NavItemProps) {
|
||||
const shouldRender = dev ? ENV !== "production" : true;
|
||||
|
||||
const [showTooltip, setShowTooltip] = useState(false);
|
||||
|
||||
return (
|
||||
shouldRender && (
|
||||
<Tooltip>
|
||||
<Tooltip open={isDesktop && showTooltip}>
|
||||
<NavLink
|
||||
to={url}
|
||||
onClick={onClick}
|
||||
@ -50,6 +54,8 @@ export default function NavItem({
|
||||
variants[variant][isActive ? "active" : "inactive"]
|
||||
}`
|
||||
}
|
||||
onMouseEnter={() => (isDesktop ? setShowTooltip(true) : null)}
|
||||
onMouseLeave={() => (isDesktop ? setShowTooltip(false) : null)}
|
||||
>
|
||||
<TooltipTrigger>
|
||||
<Icon className="size-5 md:m-[6px]" />
|
||||
|
Loading…
Reference in New Issue
Block a user