diff --git a/platform/ui/src/components/Dropdown/Dropdown.jsx b/platform/ui/src/components/Dropdown/Dropdown.jsx
index 149c55ece..b25240458 100644
--- a/platform/ui/src/components/Dropdown/Dropdown.jsx
+++ b/platform/ui/src/components/Dropdown/Dropdown.jsx
@@ -8,6 +8,42 @@ const Dropdown = ({ children, showDropdownIcon, list }) => {
const [open, setOpen] = useState(false);
const element = useRef(null);
+ const DropdownItem = ({ title, icon, onClick, index }) => {
+ const itemsAmount = list.length;
+ const isLastItem = itemsAmount === index + 1;
+
+ return (
+
{
+ setOpen(false);
+ onClick();
+ }}
+ >
+ {!!icon && }
+ {title}
+
+ );
+ };
+
+ DropdownItem.defaultProps = {
+ icon: '',
+ onClick: () => {},
+ };
+
+ DropdownItem.propTypes = {
+ title: PropTypes.string.isRequired,
+ icon: PropTypes.string,
+ onClick: PropTypes.func,
+ index: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
+ };
+
const renderTitleElement = () => {
return (
@@ -30,8 +66,6 @@ const Dropdown = ({ children, showDropdownIcon, list }) => {
};
const renderList = () => {
- const itemsAmount = list.length;
-
return (
{
}
)}
>
- {list.map(
- (
- {
- title: itemTitle,
- icon: itemIcon,
- onClick: itemOnClick = () => {},
- },
- idx
- ) => (
-
{
- setOpen(false);
- itemOnClick();
- }}
- >
- {!!itemIcon && (
-
- )}
- {itemTitle}
-
- )
- )}
+ {list.map((item, idx) => (
+
+ ))}
);
};
@@ -107,7 +121,6 @@ Dropdown.propTypes = {
title: PropTypes.string.isRequired,
icon: PropTypes.string,
onClick: PropTypes.func,
- link: PropTypes.string,
})
),
};