mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-10 10:11:33 -06:00
Better aligns with convention from Home Assistant since many Frigate users are also HA users
25 lines
797 B
TypeScript
25 lines
797 B
TypeScript
import * as React from "react";
|
|
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
|
|
import { CameraConfig } from "@/types/frigateConfig";
|
|
|
|
interface CameraNameLabelProps
|
|
extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {
|
|
camera?: string | CameraConfig;
|
|
}
|
|
|
|
const CameraNameLabel = React.forwardRef<
|
|
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
CameraNameLabelProps
|
|
>(({ className, camera, ...props }, ref) => {
|
|
const displayName = useCameraFriendlyName(camera);
|
|
return (
|
|
<LabelPrimitive.Root ref={ref} className={className} {...props}>
|
|
{displayName}
|
|
</LabelPrimitive.Root>
|
|
);
|
|
});
|
|
CameraNameLabel.displayName = LabelPrimitive.Root.displayName;
|
|
|
|
export { CameraNameLabel };
|