refactor: abstract feature property panels

This commit is contained in:
2026-07-20 17:26:35 +08:00
parent bae4b65005
commit 86389de3fa
5 changed files with 316 additions and 106 deletions
@@ -24,6 +24,7 @@ import {
ScadaFeatureIcon,
type DrainageFeatureIconProps
} from "./drainage-feature-icons";
import { FeaturePropertyList } from "./feature-property-list";
type FeaturePopoverProps = {
feature: DetailFeature | null;
@@ -156,16 +157,7 @@ export function FeaturePopover({ feature, onClose }: FeaturePopoverProps) {
<Database size={14} aria-hidden="true" />
</div>
<dl className="surface-reading divide-y divide-slate-100 rounded-xl px-3">
{panelModel.attributes.map((entry) => (
<div key={entry.key} className="grid min-h-10 grid-cols-[96px_minmax(0,1fr)] items-baseline gap-3 py-2.5">
<dt className="text-xs font-medium leading-5 text-slate-500">{entry.label}</dt>
<dd className={cn("break-words text-right text-sm font-semibold leading-5 text-slate-800 tabular-nums", entry.value === "暂无" && "font-medium text-slate-400")}>
{entry.value}
</dd>
</div>
))}
</dl>
<FeaturePropertyList entries={panelModel.attributes} variant="popover" />
</>
) : (
<p className="py-3 text-center text-sm text-slate-500"></p>