docs(docs): fix cursor handling and hover tip refactor in docs UI components

This commit is contained in:
Prad Nukala committed 2026-10-05 11:23:57 -04:00
1 parent 0d066b8104
commit 7ead021ee2
5 files changed
+24 -18

No files matched your search

+4 -4
View File
@@ -76,7 +76,7 @@ function layout(year: Day[]): { blocks: Block[]; width: number } {
export default function SubmissionHeatmap() {
const load = useStats();
const hover = useHoverTip<HTMLDivElement>();
const { ref, show, hide, node } = useHoverTip<HTMLDivElement>();
if (load.phase !== "ready") {
return (
@@ -116,7 +116,7 @@ export default function SubmissionHeatmap() {
</CardDescription>
</CardHeader>
<CardContent className="flex flex-1 items-center">
<div ref={hover.ref} className="relative w-full" onPointerLeave={hover.hide}>
<div ref={ref} className="relative w-full" onPointerLeave={hide}>
<svg
viewBox={`0 0 ${width} ${height}`}
className="h-auto w-full"
@@ -135,7 +135,7 @@ export default function SubmissionHeatmap() {
rx={2}
fill={HEAT[Math.min(cell.attempts, 4)]}
onPointerMove={(event) =>
hover.show(
show(
event,
<>
<div className="font-medium">{DAY.format(cell.date)}</div>
@@ -157,7 +157,7 @@ export default function SubmissionHeatmap() {
</g>
))}
</svg>
{hover.node}
{node}
</div>
</CardContent>
</Card>