AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
"use client";
import { motion, useReducedMotion } from "framer-motion";
import Link from "next/link";
import { ArrowLeft02Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@/components/atoms/Icon/Icon";
import { Text } from "@/components/atoms/Text/Text";
import { cn } from "@/lib/utils";
import { SectionNavItem, type SectionNavLink } from "./SectionNavItem";
interface Props {
items: (SectionNavLink & { isActive: boolean })[];
className: string;
}
export function SectionSidebar({ items, className }: Props) {
const reduceMotion = useReducedMotion();
const container = {
hidden: {},
show: {
transition: {
staggerChildren: reduceMotion ? 0 : 0.04,
delayChildren: 0.08,
},
},
};
return (
<motion.aside
initial={reduceMotion ? { opacity: 0 } : { opacity: 0, x: -10 }}
animate={{ opacity: 1, x: 0 }}
transition={{ duration: 0.25, ease: [0, 0, 0.2, 1] as const }}
className={cn(
"hidden h-full shrink-0 overflow-y-auto border-r border-[#DADADC] bg-[#F9F9FA] px-[10px] pt-[13px] md:block",
className,
)}
>
<Link
href="/copilot"
aria-label="Back to home"
className="mb-[16px] flex w-fit items-center gap-2 rounded-[8px] px-4 py-1 text-[#505057] transition-colors hover:text-[#1F1F20]"
>
<Icon icon={ArrowLeft02Icon} size={16} />
<Text variant="body" as="span" className="font-medium">
Back
</Text>
</Link>
<motion.nav
variants={container}
initial="hidden"
animate="show"
className="flex flex-col items-start gap-[7px]"
>
{items.map((item) => (
<SectionNavItem
key={item.href}
item={item}
isActive={item.isActive}
/>
))}
</motion.nav>
</motion.aside>
);
}