Skip to content

Commit 9568579

Browse files
committed
Chart legend: fixed the height of view more/hidden elements
1 parent 38abaa2 commit 9568579

1 file changed

Lines changed: 19 additions & 18 deletions

File tree

apps/webapp/app/components/primitives/charts/ChartLegendCompound.tsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React, { useMemo } from "react";
22
import { useChartContext } from "./ChartContext";
33
import { useSeriesTotal } from "./ChartRoot";
4-
import { Button } from "../Buttons";
5-
import { Paragraph } from "../Paragraph";
64
import { cn } from "~/utils/cn";
75
import { AnimatedNumber } from "../AnimatedNumber";
86

@@ -230,23 +228,26 @@ type ViewAllDataRowProps = {
230228

231229
function ViewAllDataRow({ remainingCount, onViewAll }: ViewAllDataRowProps) {
232230
return (
233-
<Button
234-
variant="minimal/small"
235-
fullWidth
236-
iconSpacing="justify-between"
237-
className="px-2 py-1"
231+
<div
232+
className="relative flex w-full cursor-pointer items-center justify-between gap-2 rounded px-2 py-1 transition hover:bg-charcoal-850"
238233
onClick={onViewAll}
234+
role="button"
235+
tabIndex={0}
236+
onKeyDown={(e) => {
237+
if (e.key === "Enter" || e.key === " ") {
238+
e.preventDefault();
239+
onViewAll?.();
240+
}
241+
}}
239242
>
240-
<div className="flex items-center gap-1.5 text-text-dimmed">
241-
<div className="h-3 w-1 rounded-[2px] border border-charcoal-600" />
242-
<Paragraph variant="small" className="tabular-nums">
243-
{remainingCount} more…
244-
</Paragraph>
243+
<div className="relative flex w-full items-center justify-between gap-3">
244+
<div className="flex items-center gap-1.5">
245+
<div className="w-1 shrink-0 self-stretch rounded-[2px] border border-charcoal-600" />
246+
<span className="text-text-dimmed tabular-nums">{remainingCount} more…</span>
247+
</div>
248+
<span className="self-start text-indigo-500">View all</span>
245249
</div>
246-
<Paragraph variant="small" className="text-indigo-500">
247-
View all
248-
</Paragraph>
249-
</Button>
250+
</div>
250251
);
251252
}
252253

@@ -266,11 +267,11 @@ function HoveredHiddenItemRow({ item, value, remainingCount }: HoveredHiddenItem
266267
style={{ backgroundColor: item.color }}
267268
/>
268269
)}
269-
<div className="relative flex w-full items-center justify-between gap-2">
270+
<div className="relative flex w-full items-center justify-between gap-3">
270271
<div className="flex items-center gap-1.5">
271272
{item.color && (
272273
<div
273-
className="h-3 w-1 shrink-0 rounded-[2px]"
274+
className="w-1 shrink-0 self-stretch rounded-[2px]"
274275
style={{ backgroundColor: item.color }}
275276
/>
276277
)}

0 commit comments

Comments
 (0)