mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 18:43:09 +03:00
* add prev/next buttons on desktop * buttons should work with summary and grid view * i18n * small tweaks * don't change dialog size * remove heading and count * remove icons * spacing * two column detail view * add actions to dots menu * move actions menu to its own component * set modal to false on face library dropdown to guard against improper closures https://github.com/shadcn-ui/ui/discussions/6908 * frigate plus layout * remove face training * clean up unused * refactor to remove duplication between mobile and desktop * turn annotation settings into a popover * fix popover * improve annotation offset popver * change icon and popover text in detail stream for annotation settings * clean up * use drawer on mobile * fix setter function * use dialog ref for popover portal * don't portal popover * tweaks * add button type * lower xl max width * fixes * justify
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import * as React from "react";
|
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
const Popover = PopoverPrimitive.Root;
|
|
|
|
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
|
|
const PopoverContent = React.forwardRef<
|
|
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
|
|
container?: HTMLElement | null;
|
|
disablePortal?: boolean;
|
|
}
|
|
>(
|
|
(
|
|
{
|
|
className,
|
|
container,
|
|
disablePortal = false,
|
|
align = "center",
|
|
sideOffset = 4,
|
|
...props
|
|
},
|
|
ref,
|
|
) => {
|
|
const content = (
|
|
<PopoverPrimitive.Content
|
|
ref={ref}
|
|
align={align}
|
|
sideOffset={sideOffset}
|
|
className={cn(
|
|
"z-50 w-72 rounded-lg border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
className,
|
|
)}
|
|
{...props}
|
|
/>
|
|
);
|
|
|
|
if (disablePortal) {
|
|
return content;
|
|
}
|
|
|
|
return (
|
|
<PopoverPrimitive.Portal container={container}>
|
|
{content}
|
|
</PopoverPrimitive.Portal>
|
|
);
|
|
},
|
|
);
|
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
|
|
export { Popover, PopoverTrigger, PopoverContent };
|