From bcb467ea020f65e7b50bd1cbd77732abbe47e8da Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 23 Mar 2023 06:36:15 +0330 Subject: [PATCH] feat: improvements --- components/Dropdown.tsx | 25 ++++++++++++------------- components/LinkList.tsx | 6 +++--- components/Sidebar/SidebarItem.tsx | 9 +++++---- components/Sidebar/index.tsx | 18 ++++++++++-------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/components/Dropdown.tsx b/components/Dropdown.tsx index 157f3da..6490027 100644 --- a/components/Dropdown.tsx +++ b/components/Dropdown.tsx @@ -19,26 +19,25 @@ export default function ({ onClickOutside, className, items }: Props) { return ( {items.map((e, i) => { + const inner = ( +
+ {React.cloneElement(e.icon, { + className: "text-sky-500 w-5 h-5", + })} +

{e.name}

+
+ ); + return e.href ? ( -
- {React.cloneElement(e.icon, { - className: "text-sky-500 w-5 h-5", - })} -

{e.name}

-
+ {inner} ) : (
-
- {React.cloneElement(e.icon, { - className: "text-sky-500 w-5 h-5", - })} -

{e.name}

-
+ {inner}
); })} diff --git a/components/LinkList.tsx b/components/LinkList.tsx index c3ff611..11d3cac 100644 --- a/components/LinkList.tsx +++ b/components/LinkList.tsx @@ -84,11 +84,11 @@ export default function ({
setEditDropdown(!editDropdown)} />
-

+

{archiveLabel}

@@ -145,7 +145,7 @@ export default function ({ }, ]} onClickOutside={() => setEditDropdown(!editDropdown)} - className="absolute top-8 right-0" + className="absolute top-10 right-0" /> ) : null}
diff --git a/components/Sidebar/SidebarItem.tsx b/components/Sidebar/SidebarItem.tsx index 4746b79..b1e7f4f 100644 --- a/components/Sidebar/SidebarItem.tsx +++ b/components/Sidebar/SidebarItem.tsx @@ -1,11 +1,10 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { IconProp } from "@fortawesome/fontawesome-svg-core"; -import { MouseEventHandler } from "react"; import Link from "next/link"; +import React, { ReactElement } from "react"; interface SidebarItemProps { text: string; - icon: IconProp; + icon: ReactElement; path: string; } @@ -13,7 +12,9 @@ export default function ({ text, icon, path }: SidebarItemProps) { return (
- + {React.cloneElement(icon, { + className: "w-4 text-sky-300", + })}

{text}

diff --git a/components/Sidebar/index.tsx b/components/Sidebar/index.tsx index 8d6c48e..c1ba807 100644 --- a/components/Sidebar/index.tsx +++ b/components/Sidebar/index.tsx @@ -49,14 +49,16 @@ export default function () { return (
-
- +
setProfileDropdown(!profileDropdown)} > -

{user?.name}

- + +
+

{user?.name}

+ +
{profileDropdown ? ( setProfileDropdown(!profileDropdown)} - className="absolute top-14 left-0" + className="absolute top-12 left-0" /> ) : null}
@@ -123,7 +125,7 @@ export default function () { } path={`/collections/${e.id}`} /> ); @@ -138,7 +140,7 @@ export default function () { } path={`/tags/${e.id}`} /> );