mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-03 21:27:48 +00:00
docs(docs): fix cursor handling and hover tip refactor in docs UI components
This commit is contained in:
1 parent
0d066b8104
commit
7ead021ee2
5 files changed
+24
-18
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user