system-copyright-react/src/components/menu/MenuWithTopButton.tsx

26 lines
850 B
TypeScript
Raw Normal View History

2024-03-12 18:53:51 +08:00
import './menu-with-top-button.css'
import {IMenuWithTopButton} from "../../interfaces/menu/IMenuWithTopButton.ts";
export default function MenuWithTopButton(props: IMenuWithTopButton) {
const list = props.list.map((item, index) => (
<li key={item.id} onClick={(e) => {
props.handleListItem(e, index, item);
}}>
<img src={item.icon} className="menu-icon" alt="加载失败"/>
<span className="menu-name">{item.name}</span>
</li>
));
return (
<div className="menu-with-top-button">
<button className="btn btn-blue top-button"
onClick={(e) => {
props.button.handle(e);
}}
>
{props.button.name}
</button>
<ul>{list}</ul>
</div>
)
}