fix dropdown
This commit is contained in:
parent
6ce531a6d2
commit
987dae9b2d
@ -10,7 +10,7 @@ const Dropdown = ({ titleElement, title, list }) => {
|
|||||||
|
|
||||||
const renderTitleElement = () => {
|
const renderTitleElement = () => {
|
||||||
if (titleElement) {
|
if (titleElement) {
|
||||||
return <>{titleElement}</>;
|
return titleElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -44,9 +44,17 @@ const Dropdown = ({ titleElement, title, list }) => {
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{list.map((item, idx) => (
|
{list.map(
|
||||||
|
(
|
||||||
|
{
|
||||||
|
title: itemTitle,
|
||||||
|
icon: itemIcon,
|
||||||
|
onClick: itemOnClick = () => {},
|
||||||
|
},
|
||||||
|
idx
|
||||||
|
) => (
|
||||||
<div
|
<div
|
||||||
key={item.title}
|
key={itemTitle}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'flex px-4 py-2 cursor-pointer items-center transition duration-300 hover:bg-secondary-main',
|
'flex px-4 py-2 cursor-pointer items-center transition duration-300 hover:bg-secondary-main',
|
||||||
{
|
{
|
||||||
@ -55,18 +63,16 @@ const Dropdown = ({ titleElement, title, list }) => {
|
|||||||
)}
|
)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
|
itemOnClick();
|
||||||
if (item.onClick) {
|
|
||||||
item.onClick();
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!!item.icon && (
|
{!!itemIcon && (
|
||||||
<Icon name={item.icon} className="text-white w-4 mr-2" />
|
<Icon name={itemIcon} className="text-white w-4 mr-2" />
|
||||||
)}
|
)}
|
||||||
<Typography>{item.title}</Typography>
|
<Typography>{itemTitle}</Typography>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user