26 lines
850 B
TypeScript
26 lines
850 B
TypeScript
|
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>
|
||
|
)
|
||
|
}
|