mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-24 23:57:41 +03:00
fix: fix cameraNameLabel visually
This commit is contained in:
parent
c7c03a64bc
commit
7f655cc77d
@ -1,18 +1,10 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as LabelPrimitive from "@radix-ui/react-label";
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
||||||
import { cva, type VariantProps } from "class-variance-authority";
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import { useCameraNickname } from "@/hooks/use-camera-nickname";
|
import { useCameraNickname } from "@/hooks/use-camera-nickname";
|
||||||
import { CameraConfig } from "@/types/frigateConfig";
|
import { CameraConfig } from "@/types/frigateConfig";
|
||||||
|
|
||||||
const labelVariants = cva(
|
|
||||||
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
||||||
);
|
|
||||||
|
|
||||||
interface CameraNameLabelProps
|
interface CameraNameLabelProps
|
||||||
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,
|
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
|
||||||
VariantProps<typeof labelVariants> {
|
|
||||||
camera?: string | CameraConfig;
|
camera?: string | CameraConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,11 +14,7 @@ const CameraNameLabel = React.forwardRef<
|
|||||||
>(({ className, camera, ...props }, ref) => {
|
>(({ className, camera, ...props }, ref) => {
|
||||||
const displayName = useCameraNickname(camera);
|
const displayName = useCameraNickname(camera);
|
||||||
return (
|
return (
|
||||||
<LabelPrimitive.Root
|
<LabelPrimitive.Root ref={ref} className={className} {...props}>
|
||||||
ref={ref}
|
|
||||||
className={cn(labelVariants(), className)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{displayName}
|
{displayName}
|
||||||
</LabelPrimitive.Root>
|
</LabelPrimitive.Root>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export default function FilterSwitch({
|
|||||||
<div className="flex items-center justify-between gap-1">
|
<div className="flex items-center justify-between gap-1">
|
||||||
{isCameraName ? (
|
{isCameraName ? (
|
||||||
<CameraNameLabel
|
<CameraNameLabel
|
||||||
className={`mx-2 w-full cursor-pointer text-primary smart-capitalize ${disabled ? "text-secondary-foreground" : ""}`}
|
className={`mx-2 w-full cursor-pointer text-sm font-medium leading-none text-primary smart-capitalize peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${disabled ? "text-secondary-foreground" : ""}`}
|
||||||
htmlFor={label}
|
htmlFor={label}
|
||||||
camera={label}
|
camera={label}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user