Merge pull request #530 from storytold/fixes/dropdown_key

dropdown menu needs a key
This commit is contained in:
wil authored and GitHub committed 2024-03-05 19:34:19 -05:00
commit 096e37047c
1 file changed
+22 -23
@@ -32,9 +32,9 @@ export default function DropdownMenu({
return (
<a.div style={fadeIn} className={`fy-dropdown-menu ${className}`.trim()}>
{items.map(item => (
<>
{item.onClick ? (
{items.map(item => {
if(item.onClick){
return(
<div
key={item.id}
onClick={e => {
@@ -53,27 +53,26 @@ export default function DropdownMenu({
{item.name}
</span>
</div>
) : (
<>
{item.link && (
<Link
key={item.id}
to={item.link}
className="fy-dropdown-item"
onClick={() => onClose()}
>
<span>
{item.icon && (
<FontAwesomeIcon icon={item.icon} className="me-2 fs-7" />
)}
{item.name}
</span>
</Link>
);
} else if (item.link) {
return(
<Link
key={item.id}
to={item.link}
className="fy-dropdown-item"
onClick={() => onClose()}
>
<span>
{item.icon && (
<FontAwesomeIcon icon={item.icon} className="me-2 fs-7" />
)}
</>
)}
</>
))}
{item.name}
</span>
</Link>
);
}//end if
return null;
})} {/*end items map */}
</a.div>
);
}