fix: fix cameraNameLabel visually

This commit is contained in:
ZhaiSoul 2025-08-21 06:26:05 +00:00
parent c7c03a64bc
commit 7f655cc77d
2 changed files with 3 additions and 15 deletions

View File

@ -1,18 +1,10 @@
import * as React from "react";
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 { CameraConfig } from "@/types/frigateConfig";
const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
);
interface CameraNameLabelProps
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>,
VariantProps<typeof labelVariants> {
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
camera?: string | CameraConfig;
}
@ -22,11 +14,7 @@ const CameraNameLabel = React.forwardRef<
>(({ className, camera, ...props }, ref) => {
const displayName = useCameraNickname(camera);
return (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
>
<LabelPrimitive.Root ref={ref} className={className} {...props}>
{displayName}
</LabelPrimitive.Root>
);

View File

@ -20,7 +20,7 @@ export default function FilterSwitch({
<div className="flex items-center justify-between gap-1">
{isCameraName ? (
<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}
camera={label}
/>