import React, { useState } from "react"; import TextInput from "./TextInput"; import Popover from "./Popover"; import { HexColorPicker } from "react-colorful"; import { useTranslation } from "next-i18next"; import Icon from "./Icon"; import { IconWeight } from "@phosphor-icons/react"; import IconGrid from "./IconGrid"; type Props = { alignment?: string; color: string; setColor: Function; iconName?: string; setIconName: Function; weight: "light" | "regular" | "bold" | "fill" | "duotone" | "thin"; setWeight: Function; hideDefaultIcon?: boolean; reset: Function; className?: string; }; const IconPicker = ({ alignment, color, setColor, iconName, setIconName, weight, setWeight, hideDefaultIcon, className, reset, }: Props) => { const { t } = useTranslation(); const [query, setQuery] = useState(""); const [iconPicker, setIconPicker] = useState(false); return (
setIconPicker(!iconPicker)} className="btn btn-square w-20 h-20" > {iconName ? ( ) : !iconName && hideDefaultIcon ? (

{t("set_custom_icon")}

) : ( )}
{iconPicker && ( setIconPicker(false)} className={ className + " fade-in bg-base-200 border border-neutral-content p-2 h-44 w-[22.5rem] rounded-lg backdrop-blur-sm bg-opacity-90 " + (alignment || " lg:-translate-x-1/3 top-20 left-0 ") } >
} > {t("reset")}
setColor(e)} />
setQuery(e.target.value)} />
)}
); }; export default IconPicker;