'use client' import { Eye, EyeOff } from 'lucide-react' import { useState } from 'react' import { Button } from '@/components/ui/button' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover' import { Slider } from '@/components/ui/slider' import { cn } from '@/lib/utils' interface OpacityControlProps { visible?: boolean opacity?: number onVisibilityToggle: () => void onOpacityChange: (opacity: number) => void className?: string } export function OpacityControl({ visible = true, opacity = 100, onVisibilityToggle, onOpacityChange, className, }: OpacityControlProps) { const [isOpen, setIsOpen] = useState(false) const actualOpacity = opacity ?? 100 const isHidden = visible === false || actualOpacity === 0 return (
{!isHidden && actualOpacity < 100 && ( {actualOpacity}% )} e.stopPropagation()} side="right" >
Opacity {actualOpacity}%
{ onOpacityChange(value) }} step={1} value={[actualOpacity]} />
) }