customizable icon color

This commit is contained in:
Daniel
2023-06-02 15:29:52 +03:30
parent 3e6bef875b
commit be180d34e2
11 changed files with 165 additions and 99 deletions
+13 -3
View File
@@ -7,9 +7,16 @@ interface SidebarItemProps {
icon: ReactElement;
path: string;
className?: string;
iconColor?: string;
}
export default function ({ text, icon, path, className }: SidebarItemProps) {
export default function ({
text,
icon,
path,
className,
iconColor,
}: SidebarItemProps) {
const router = useRouter();
const [active, setActive] = useState(false);
@@ -23,10 +30,13 @@ export default function ({ text, icon, path, className }: SidebarItemProps) {
<div
className={`${
active ? "bg-sky-500" : "hover:bg-slate-200 bg-gray-100"
} duration-100 py-1 px-4 cursor-pointer flex items-center gap-2 w-full ${className}`}
} duration-100 py-1 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md ${className}`}
>
{React.cloneElement(icon, {
className: `w-4 h-4 ${active ? "text-white" : "text-sky-300"}`,
className: "w-4 h-4",
style: {
color: active ? "white" : iconColor ? iconColor : "#7dd3fc",
},
})}
<p
className={`${active ? "text-white" : "text-sky-900"} truncate w-4/6`}