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

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

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

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

export default MenuList;
