Aurora Admin v1.2.0: 79 components x 5 ends, doc site, contracts batch 1, playground, regression, deploy ready

This commit is contained in:
aurora-admin
2026-09-10 19:21:56 +08:00
commit 51ce3a28f7
654 changed files with 49082 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import React, { useState } from 'react';
import './TopMenu.css';
export default function TopMenu({ items = [], activeKey = '', onChange }) {
const [active, setActive] = useState(activeKey);
function isActive(it) {
if (it.key === active) return true;
return (it.children || []).some(s => s.key === active);
}
function select(it) {
if (!it.children) {
setActive(it.key);
onChange && onChange(it.key);
}
}
return (
<div className="aa-topmenu">
{items.map((it, i) => (
<div
key={i}
className={'aa-topmenu-item' + (isActive(it) ? ' is-active' : '')}
onClick={() => select(it)}
>
<span>{it.label}</span>
{it.badge ? <span className="aa-topmenu-badge">{it.badge}</span> : null}
{it.children ? <span className="aa-topmenu-caret">▾</span> : null}
{it.children ? (
<div className="aa-topmenu-dropdown">
{it.children.map((s, si) => (
<a
key={si}
className={'aa-topmenu-sub' + (s.key === active ? ' is-active' : '')}
onClick={e => { e.stopPropagation(); select(s); }}
>
{s.label}
</a>
))}
</div>
) : null}
</div>
))}
</div>
);
}