Skip to content

Commit

Permalink
fix(view): make storage label more floaty
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceNino committed Jun 30, 2022
1 parent 20e273f commit 9619e27
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions apps/view/src/components/chart-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,30 @@ export const DefaultPieChart: FC<DefaultPieChartProps> = ({
);

const minSize = Math.min(height, width);
const labelWidth = labelRef.current?.offsetWidth || 0;
const labelHeight = labelRef.current?.offsetHeight || 0;
const labelWidth = labelRef.current?.offsetWidth || 120;
const labelHeight = labelRef.current?.offsetHeight || 50;

const coords = label
? getCoords(
label,
{ width, height },
{ width: labelWidth, height: labelHeight }
)
: undefined;

return (
<>
{label && (
<HoverLabel
ref={labelRef}
initial={{
top: label.y,
left: label.x + 20,
initial={{ ...coords, opacity: 0 }}
animate={{
...coords,
opacity: 1,
transition: {
duration: 0.3,
},
}}
animate={getCoords(
label,
{ width, height },
{ width: labelWidth, height: labelHeight }
)}
>
{label.label}
</HoverLabel>
Expand Down

0 comments on commit 9619e27

Please sign in to comment.