import React from "react";
import { IFolderTree } from "@ax/types";
import MenuItem from "../MenuItem";

const MenuList = (props: IMenuListProps) => {
	const { list, folderID, hidden, createAction, onClick } = props;

	return (
		<ul>
			{list.map((listItem, index) => (
				<MenuItem
					key={index}
					item={listItem}
					onClick={onClick}
					folderID={folderID}
					createAction={createAction}
					hidden={hidden}
				/>
			))}
		</ul>
	);
};

interface IMenuListProps {
	list: IFolderTree[];
	folderID: number;
	hidden?: number[];
	trimNames?: boolean;
	createAction?(): void;
	onClick(folderID: number): void;
}

export default MenuList;
