"use client";
import {
Bell,
Heart,
Home,
LogOut,
PanelBottomOpen,
Settings,
ShoppingCart,
User,
} from "lucide-react";
import type { MotionValue } from "motion/react";
import {
AnimatePresence,
motion,
useMotionValue,
useSpring,
useTransform,
} from "motion/react";
import { useRef, useState } from "react";
import * as React from "react";
import { cn } from "@/lib/utils";
interface Navbar24Props {
/** When true, positions inside the block preview instead of the viewport. */
contained?: boolean;
className?: string;
}
const Navbar24 = ({ contained = false, className }: Navbar24Props) => {
const dockPosition = contained ? "absolute" : "fixed";
const tabs = [
{
title: "خانه",
icon: ,
href: "#home",
},
{
title: "اعلانها",
icon: ,
href: "#notifications",
},
{
title: "پروفایل",
icon: ,
href: "#profile",
},
{
title: "تنظیمات",
icon: ,
href: "#settings",
},
{
title: "نشانشدهها",
icon: ,
href: "#favorites",
},
{
title: "پلنها",
icon: ,
href: "#cart",
},
{
title: "خروج",
icon: ,
href: "#logout",
},
];
return (
);
};
export { Navbar24 };
// Below is the modified component from Aceternity UI
// Original source: npx shadcn@latest add https://ui.aceternity.com/registry/floating-dock.json
// Modified to follow our coding standards and design system
// We respect copyright and attribution to the original creators
const FloatingDock = ({
items,
desktopClassName,
mobileClassName,
contained = false,
}: {
items: { title: string; icon: React.ReactNode; href: string }[];
desktopClassName?: string;
mobileClassName?: string;
contained?: boolean;
}) => {
return (
<>
>
);
};
const FloatingDockMobile = ({
items,
className,
}: {
items: { title: string; icon: React.ReactNode; href: string }[];
className?: string;
}) => {
const [open, setOpen] = useState(false);
return (
{open && (
{items.map((item, idx) => (
{item.icon}
))}
)}
);
};
const FloatingDockDesktop = ({
items,
className,
}: {
items: { title: string; icon: React.ReactNode; href: string }[];
className?: string;
}) => {
const mouseX = useMotionValue(Infinity);
return (
mouseX.set(e.pageX)}
onMouseLeave={() => mouseX.set(Infinity)}
className={cn(
"z-99 mx-auto hidden h-16 items-center justify-center gap-2 rounded-3xl bg-foreground px-5 md:flex",
className,
)}
>
{items.map((item) => (
))}
);
};
function IconContainer({
mouseX,
title,
icon,
href,
}: {
mouseX: MotionValue;
title: string;
icon: React.ReactNode;
href: string;
}) {
const ref = useRef(null);
const distance = useTransform(mouseX, (val) => {
const bounds = ref.current?.getBoundingClientRect() ?? { x: 0, width: 0 };
return val - bounds.x - bounds.width / 2;
});
const widthTransform = useTransform(distance, [-150, 0, 150], [40, 60, 40]);
const heightTransform = useTransform(distance, [-150, 0, 150], [40, 60, 40]);
const widthTransformIcon = useTransform(
distance,
[-150, 0, 150],
[20, 40, 20],
);
const heightTransformIcon = useTransform(
distance,
[-150, 0, 150],
[20, 40, 20],
);
const width = useSpring(widthTransform, {
mass: 0.1,
stiffness: 150,
damping: 12,
});
const height = useSpring(heightTransform, {
mass: 0.1,
stiffness: 150,
damping: 12,
});
const widthIcon = useSpring(widthTransformIcon, {
mass: 0.1,
stiffness: 150,
damping: 12,
});
const heightIcon = useSpring(heightTransformIcon, {
mass: 0.1,
stiffness: 150,
damping: 12,
});
const rounded = useSpring(
useTransform(distance, [-150, 0, 150], [50, 10, 50]),
{
mass: 0.1,
stiffness: 150,
damping: 12,
},
);
const [hovered, setHovered] = useState(false);
return (
setHovered(true)}
onMouseLeave={() => setHovered(false)}
className="relative flex aspect-square items-center justify-center bg-background/10"
>
{hovered && (
{title}
)}
{icon}
);
}