feat: 添加信息和指标组件以增强充电订单和计量信息的展示
This commit is contained in:
15
apps/web/components/info-section.tsx
Normal file
15
apps/web/components/info-section.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
type InfoSectionProps = {
|
||||
title: string;
|
||||
children: ReactNode;
|
||||
};
|
||||
|
||||
export default function InfoSection({ title, children }: InfoSectionProps) {
|
||||
return (
|
||||
<div className="rounded-xl border border-border bg-surface p-4">
|
||||
<h2 className="mb-3 text-sm font-semibold text-foreground">{title}</h2>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
41
apps/web/components/metric-indicator.tsx
Normal file
41
apps/web/components/metric-indicator.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { Card } from "@heroui/react";
|
||||
|
||||
type MetricIndicatorProps = {
|
||||
title: string;
|
||||
value: ReactNode;
|
||||
hint?: ReactNode;
|
||||
footer?: ReactNode;
|
||||
icon?: ReactNode;
|
||||
color?: string;
|
||||
valueClassName?: string;
|
||||
};
|
||||
|
||||
export default function MetricIndicator({
|
||||
title,
|
||||
value,
|
||||
hint,
|
||||
footer,
|
||||
icon,
|
||||
color = "border-border",
|
||||
valueClassName = "text-xl font-semibold text-foreground tabular-nums",
|
||||
}: MetricIndicatorProps) {
|
||||
return (
|
||||
<Card className={`border-t-2 ${color}`}>
|
||||
<Card.Content className="flex flex-col gap-3">
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<p className="text-xs text-muted">{title}</p>
|
||||
{icon}
|
||||
</div>
|
||||
<p className={valueClassName}>{value}</p>
|
||||
{footer ? (
|
||||
<div className="flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-muted">
|
||||
{footer}
|
||||
</div>
|
||||
) : (
|
||||
hint && <div className="text-xs text-muted">{hint}</div>
|
||||
)}
|
||||
</Card.Content>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user