mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-01-31 00:18:55 +01:00
509e46adc8
* Add ui for events * Display data for review items * Use preview thumbnails * Implement paging * Show icons for what was detected * Show progress bar on preview thumbnail * Hide the overlays on hover and update reviewed status * Dim previews that have been reviewed * Show audio icons * Cleanup preview thumb player * initial implementation of review timeline * Use timeout for hover playback * Break apart mobile and desktop views * Show icons for sub labels * autoplay first video on mobile * Only show the last 24 hours by default * Rework scrolling to fix nested scrolling * Final scroll cleanups --------- Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import * as React from "react"
|
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
import { VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { toggleVariants } from "@/components/ui/toggle"
|
|
|
|
const ToggleGroupContext = React.createContext<
|
|
VariantProps<typeof toggleVariants>
|
|
>({
|
|
size: "default",
|
|
variant: "default",
|
|
})
|
|
|
|
const ToggleGroup = React.forwardRef<
|
|
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
|
|
VariantProps<typeof toggleVariants>
|
|
>(({ className, variant, size, children, ...props }, ref) => (
|
|
<ToggleGroupPrimitive.Root
|
|
ref={ref}
|
|
className={cn("flex items-center justify-center gap-1", className)}
|
|
{...props}
|
|
>
|
|
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
{children}
|
|
</ToggleGroupContext.Provider>
|
|
</ToggleGroupPrimitive.Root>
|
|
))
|
|
|
|
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
|
|
|
|
const ToggleGroupItem = React.forwardRef<
|
|
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
|
|
VariantProps<typeof toggleVariants>
|
|
>(({ className, children, variant, size, ...props }, ref) => {
|
|
const context = React.useContext(ToggleGroupContext)
|
|
|
|
return (
|
|
<ToggleGroupPrimitive.Item
|
|
ref={ref}
|
|
className={cn(
|
|
toggleVariants({
|
|
variant: context.variant || variant,
|
|
size: context.size || size,
|
|
}),
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
</ToggleGroupPrimitive.Item>
|
|
)
|
|
})
|
|
|
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
|
|
|
|
export { ToggleGroup, ToggleGroupItem }
|