mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 16:56:22 +02:00
Initial commit
This commit is contained in:
commit
55332d1ddb
168 changed files with 18456 additions and 0 deletions
|
|
@ -0,0 +1,82 @@
|
|||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
|
||||
export default function LinkComponent(...props: any) {
|
||||
const activeLink = props[0].activeLink;
|
||||
const collapsed = props[0].collapsed;
|
||||
const animationDuration = props[0].animationDuration;
|
||||
|
||||
return (
|
||||
<Link href={props[0].href}>
|
||||
{collapsed ? (
|
||||
<TooltipProvider delayDuration={150}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div
|
||||
className={`flex flex-row gap-6 rounded-md py-3 font-normal ${
|
||||
collapsed ? "justify-center" : "items-center"
|
||||
} ${activeLink ? "bg-border text-foreground" : ""}`}
|
||||
>
|
||||
<div className={collapsed ? "p-0" : "pl-4"}>
|
||||
{props[0].icon}
|
||||
</div>
|
||||
<AnimatePresence>
|
||||
<motion.div
|
||||
layout
|
||||
animate={{
|
||||
x: collapsed ? -20 : 0,
|
||||
y: collapsed ? 0 : 0,
|
||||
opacity: collapsed ? 0 : 1,
|
||||
width: collapsed ? 0 : "auto",
|
||||
display: collapsed ? "none" : "block",
|
||||
}}
|
||||
transition={{ duration: animationDuration }}
|
||||
className="text-sm"
|
||||
>
|
||||
{props[0].label}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>{props[0].label}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
) : (
|
||||
<div
|
||||
className={`flex flex-row gap-6 rounded-md py-3 font-normal ${
|
||||
collapsed ? "justify-center" : "items-center"
|
||||
} ${activeLink ? "bg-border text-foreground" : ""}`}
|
||||
>
|
||||
<div className={collapsed ? "p-0" : "pl-4"}>{props[0].icon}</div>
|
||||
<AnimatePresence>
|
||||
<motion.div
|
||||
layout
|
||||
animate={{
|
||||
x: collapsed ? -20 : 0,
|
||||
y: collapsed ? 0 : 0,
|
||||
opacity: collapsed ? 0 : 1,
|
||||
width: collapsed ? 0 : "auto",
|
||||
display: collapsed ? "none" : "block",
|
||||
}}
|
||||
transition={{ duration: animationDuration }}
|
||||
className="text-sm"
|
||||
>
|
||||
{props[0].label}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue