merge fix
This commit is contained in:
@@ -13,6 +13,7 @@ interface DropDownListProps {
|
||||
kebabMenuItems?: { id: string; name: string }[]; // Items for the KebabMenuList
|
||||
defaultOpen?: boolean; // Determines if the dropdown list should be open by default
|
||||
listType?: string; // Type of list to display
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
const DropDownList: React.FC<DropDownListProps> = ({
|
||||
@@ -28,25 +29,29 @@ const DropDownList: React.FC<DropDownListProps> = ({
|
||||
],
|
||||
defaultOpen = false,
|
||||
listType = "default",
|
||||
remove,
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState<boolean>(defaultOpen);
|
||||
|
||||
const handleToggle = () => {
|
||||
setIsOpen((prev) => !prev); // Toggle the state
|
||||
};
|
||||
const [zoneDataList, setZoneDataList] = useState<{ id: string; name: string }[]>([]);
|
||||
const [zoneDataList, setZoneDataList] = useState<
|
||||
{ id: string; name: string }[]
|
||||
>([]);
|
||||
|
||||
useEffect(() => {
|
||||
async function GetZoneData() {
|
||||
const response = await getZonesApi("hexrfactory")
|
||||
console.log('response: ', response.data);
|
||||
setZoneDataList([{ id: "1", name: "zone1" },
|
||||
{ id: "2", name: "Zone 2" },])
|
||||
const response = await getZonesApi("hexrfactory");
|
||||
console.log("response: ", response.data);
|
||||
setZoneDataList([
|
||||
{ id: "1", name: "zone1" },
|
||||
{ id: "2", name: "Zone 2" },
|
||||
]);
|
||||
}
|
||||
|
||||
GetZoneData()
|
||||
|
||||
}, [])
|
||||
GetZoneData();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="dropdown-list-container">
|
||||
@@ -81,7 +86,7 @@ const DropDownList: React.FC<DropDownListProps> = ({
|
||||
</div>
|
||||
{isOpen && (
|
||||
<div className="lists-container">
|
||||
{listType === "default" && <List items={items} />}
|
||||
{listType === "default" && <List items={items} remove={remove} />}
|
||||
{listType === "outline" && (
|
||||
<>
|
||||
<DropDownList
|
||||
|
||||
@@ -5,10 +5,11 @@ import { EyeIcon, LockIcon, RmoveIcon } from "../../icons/ExportCommonIcons";
|
||||
interface ListProps {
|
||||
items?: { id: string; name: string }[]; // Optional array of items to render
|
||||
placeholder?: string; // Optional placeholder text
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
const List: React.FC<ListProps> = ({ items = [] }) => {
|
||||
console.log('items: ', items);
|
||||
const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||
console.log("items: ", items);
|
||||
return (
|
||||
<>
|
||||
{items.length > 0 ? (
|
||||
@@ -26,9 +27,11 @@ const List: React.FC<ListProps> = ({ items = [] }) => {
|
||||
<div className="visibe option">
|
||||
<EyeIcon isClosed />
|
||||
</div>
|
||||
<div className="remove option">
|
||||
<RmoveIcon />
|
||||
</div>
|
||||
{remove && (
|
||||
<div className="remove option">
|
||||
<RmoveIcon />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user