Skip to content

Commit 79d5ac9

Browse files
authored
Merge pull request #23 from lassiecoder/staging
Staging
2 parents ffa798f + 5bff2d0 commit 79d5ac9

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

src/components/ui/floating-dock.tsx

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import {
1212
motion,
1313
useMotionValue,
1414
useSpring,
15-
useTransform
15+
useTransform,
1616
} from "framer-motion";
1717
import Link from "next/link";
1818
import { useRef, useState } from "react";
1919

2020
export const FloatingDock = ({
2121
items,
2222
desktopClassName,
23-
mobileClassName
23+
mobileClassName,
2424
}: {
2525
items: { title: string; icon: React.ReactNode; href: string }[];
2626
desktopClassName?: string;
@@ -36,7 +36,7 @@ export const FloatingDock = ({
3636

3737
const FloatingDockMobile = ({
3838
items,
39-
className
39+
className,
4040
}: {
4141
items: { title: string; icon: React.ReactNode; href: string }[];
4242
className?: string;
@@ -50,7 +50,7 @@ const FloatingDockMobile = ({
5050
layoutId="nav"
5151
{...{
5252
className:
53-
"absolute bottom-full mb-2 inset-x-0 flex flex-col gap-2"
53+
"absolute bottom-full mb-2 inset-x-0 flex flex-col gap-2",
5454
}}
5555
>
5656
{items.map((item, idx) => (
@@ -59,14 +59,14 @@ const FloatingDockMobile = ({
5959
initial={{ opacity: 0, y: 10 }}
6060
animate={{
6161
opacity: 1,
62-
y: 0
62+
y: 0,
6363
}}
6464
exit={{
6565
opacity: 0,
6666
y: 10,
6767
transition: {
68-
delay: idx * 0.05
69-
}
68+
delay: idx * 0.05,
69+
},
7070
}}
7171
transition={{ delay: (items.length - 1 - idx) * 0.05 }}
7272
>
@@ -94,24 +94,20 @@ const FloatingDockMobile = ({
9494

9595
const FloatingDockDesktop = ({
9696
items,
97-
className
97+
className,
9898
}: {
9999
items: { title: string; icon: React.ReactNode; href: string }[];
100100
className?: string;
101101
}) => {
102102
let mouseX = useMotionValue(Infinity);
103103
return (
104104
<motion.div
105-
// onMouseMove={(e) => mouseX.set(e.pageX)}
106-
// onMouseLeave={() => mouseX.set(Infinity)}
107-
{...{
108-
onMouseMove: (e: MouseEvent) => mouseX.set(e.pageX),
109-
onMouseLeave: (e: MouseEvent) => mouseX.set(Infinity),
110-
className: cn(
111-
"mx-auto hidden md:flex h-16 gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4 pb-3",
112-
className
113-
)
114-
}}
105+
onMouseMove={(e) => mouseX.set(e.pageX)}
106+
onMouseLeave={() => mouseX.set(Infinity)}
107+
className={cn(
108+
"mx-auto hidden md:flex h-16 gap-4 items-end rounded-2xl bg-gray-50 dark:bg-neutral-900 px-4 pb-3",
109+
className
110+
)}
115111
>
116112
{items.map((item) => (
117113
<IconContainer mouseX={mouseX} key={item.title} {...item} />
@@ -124,7 +120,7 @@ function IconContainer({
124120
mouseX,
125121
title,
126122
icon,
127-
href
123+
href,
128124
}: {
129125
mouseX: MotionValue;
130126
title: string;
@@ -152,23 +148,23 @@ function IconContainer({
152148
let width = useSpring(widthTransform, {
153149
mass: 0.1,
154150
stiffness: 150,
155-
damping: 12
151+
damping: 12,
156152
});
157153
let height = useSpring(heightTransform, {
158154
mass: 0.1,
159155
stiffness: 150,
160-
damping: 12
156+
damping: 12,
161157
});
162158

163159
let widthIcon = useSpring(widthTransformIcon, {
164160
mass: 0.1,
165161
stiffness: 150,
166-
damping: 12
162+
damping: 12,
167163
});
168164
let heightIcon = useSpring(heightTransformIcon, {
169165
mass: 0.1,
170166
stiffness: 150,
171-
damping: 12
167+
damping: 12,
172168
});
173169

174170
const [hovered, setHovered] = useState(false);
@@ -182,7 +178,7 @@ function IconContainer({
182178
onMouseEnter: () => setHovered(true),
183179
onMouseLeave: () => setHovered(false),
184180
className:
185-
"aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative"
181+
"aspect-square rounded-full bg-gray-200 dark:bg-neutral-800 flex items-center justify-center relative",
186182
}}
187183
>
188184
<AnimatePresence>

0 commit comments

Comments
 (0)