import { useRef, useState } from "react"; import { HexColorPicker, HexColorInput } from "react-colorful"; import { motion, AnimatePresence } from "framer-motion"; import { useClickOutside } from "renderer/hooks/use-click-outside.hook"; import { BsmButton } from "../shared/bsm-button.component"; export default function SettingColorChooser({ color, onChange, pickerClassName }: { color?: string; onChange?: (color: string) => void; pickerClassName?: string }) { const [colorVisible, setColorVisible] = useState(false); const ref = useRef(null); useClickOutside(ref, () => setColorVisible(() => false)); return (
setColorVisible(!colorVisible)} style={{ backgroundColor: color }} /> {colorVisible && (
setColorVisible(() => false)} />
)}
); }