style: better network tooltip

This commit is contained in:
hamster1963 2025-01-25 10:57:16 +08:00
parent ea7b8969ee
commit d7f9e378fe

View File

@ -164,12 +164,19 @@ const ChartTooltipContent = React.forwardRef<
<div <div
ref={ref} ref={ref}
className={cn( className={cn(
"grid min-w-[8rem] items-start gap-1.5 rounded-sm border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", "grid min-w-[8rem] items-start overflow-hidden gap-1.5 rounded-sm border border-border/50 bg-stone-100 dark:bg-stone-900 text-xs shadow-xl",
className, className,
)} )}
> >
{!nestLabel ? tooltipLabel : null} {!nestLabel && (
<div className="grid gap-1.5"> <p className="px-2.5 pt-1 mx-auto -mb-1">{!nestLabel ? tooltipLabel : null}</p>
)}
<div
className={cn("grid gap-1.5 bg-white dark:bg-black px-2.5 py-1.5", {
"border-t-[1px]": !nestLabel,
})}
>
{payload.map((item, index) => { {payload.map((item, index) => {
const key = `${nameKey || item.name || item.dataKey || "value"}` const key = `${nameKey || item.name || item.dataKey || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key) const itemConfig = getPayloadConfigFromPayload(config, item, key)