minor improvement
This commit is contained in:
parent
60aa7b830e
commit
0dda77db1e
|
@ -84,14 +84,24 @@ const CollectionItem = ({
|
||||||
}, [isActiveOrParentOfActive]);
|
}, [isActiveOrParentOfActive]);
|
||||||
|
|
||||||
return hasChildren ? (
|
return hasChildren ? (
|
||||||
<details open={isOpen}>
|
<>
|
||||||
<summary
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
active === `/collections/${collection.id}`
|
active === `/collections/${collection.id}`
|
||||||
? "bg-primary/20"
|
? "bg-primary/20"
|
||||||
: "hover:bg-neutral/20"
|
: "hover:bg-neutral/20"
|
||||||
} duration-100 rounded-md flex w-full items-center cursor-pointer mb-1 px-2`}
|
} duration-100 rounded-md flex w-full items-center cursor-pointer mb-1 px-2 gap-1`}
|
||||||
>
|
>
|
||||||
|
<button
|
||||||
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
|
className="flex items-center"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className={`bi-chevron-down ${
|
||||||
|
isOpen ? "rotate-reverse" : "rotate"
|
||||||
|
}`}
|
||||||
|
></i>
|
||||||
|
</button>
|
||||||
<Link href={`/collections/${collection.id}`} className="w-full">
|
<Link href={`/collections/${collection.id}`} className="w-full">
|
||||||
<div
|
<div
|
||||||
className={`py-1 cursor-pointer flex items-center gap-2 w-full h-8 capitalize`}
|
className={`py-1 cursor-pointer flex items-center gap-2 w-full h-8 capitalize`}
|
||||||
|
@ -113,10 +123,9 @@ const CollectionItem = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</summary>
|
</div>
|
||||||
|
{isOpen && hasChildren && (
|
||||||
{hasChildren && (
|
<div className="ml-4 pl-1 border-l border-neutral-content">
|
||||||
<div className="ml-3 pl-1 border-l border-neutral-content">
|
|
||||||
{collections
|
{collections
|
||||||
.filter((e) => e.parentId === collection.id)
|
.filter((e) => e.parentId === collection.id)
|
||||||
.map((subCollection) => (
|
.map((subCollection) => (
|
||||||
|
@ -129,7 +138,7 @@ const CollectionItem = ({
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</details>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Link href={`/collections/${collection.id}`} className="w-full">
|
<Link href={`/collections/${collection.id}`} className="w-full">
|
||||||
<div
|
<div
|
||||||
|
|
Ŝarĝante…
Reference in New Issue