Skip to content

Commit dacbd16

Browse files
committed
fix: ref issue
1 parent c7089bb commit dacbd16

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/components/ui/floating-dock.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ function IconContainer({
127127
icon: React.ReactNode;
128128
href: string;
129129
}) {
130-
// let ref = useRef<HTMLDivElement>(null);
131-
const ref = useRef<HTMLDivElement>(null!) as React.RefObject<HTMLElement>;
130+
let ref = useRef<HTMLDivElement>(null);
132131

133132
let distance = useTransform(mouseX, (val) => {
134133
let bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };
@@ -174,13 +173,10 @@ function IconContainer({
174173
<Link href={href}>
175174
<motion.div
176175
ref={ref}
177-
{...{
178-
style: { width, height },
179-
onMouseEnter: () => setHovered(true),
180-
onMouseLeave: () => setHovered(false),
181-
className:
182-
"aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative",
183-
}}
176+
style={{ width, height }}
177+
onMouseEnter={() => setHovered(true)}
178+
onMouseLeave={() => setHovered(false)}
179+
className="aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative"
184180
>
185181
<AnimatePresence>
186182
{/* {hovered && (

0 commit comments

Comments
 (0)