import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import Link from "next/link";
import { cn } from "../../../utils/cn";
export const AdminLayout = ({ children, menuItems, currentPath, sidebarOpen = true, onSidebarToggle, onLogout, }) => {
    const isActive = (path, exact) => {
        if (exact) {
            return currentPath === path;
        }
        return currentPath?.startsWith(path) || false;
    };
    return (_jsxs("div", { className: "min-h-screen bg-neutral-50 dark:bg-neutral-900 flex", children: [_jsxs("aside", { className: cn("fixed left-0 top-0 h-screen bg-white dark:bg-neutral-800 border-r border-neutral-200 dark:border-neutral-700 transition-all duration-300 flex flex-col z-50", sidebarOpen ? "w-64" : "w-20"), children: [_jsxs("div", { className: "p-4 border-b border-neutral-200 dark:border-neutral-700 flex items-center justify-between flex-shrink-0", children: [sidebarOpen && (_jsx("h1", { className: "text-xl font-bold text-neutral-900 dark:text-white", children: "CMS Admin" })), onSidebarToggle && (_jsx("button", { onClick: onSidebarToggle, className: "p-2 rounded-lg hover:bg-neutral-100 dark:hover:bg-neutral-700", "aria-label": sidebarOpen ? "Collapse sidebar" : "Expand sidebar", children: _jsx("svg", { className: "w-5 h-5 text-neutral-600 dark:text-neutral-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: sidebarOpen
                                            ? "M6 18L18 6M6 6l12 12"
                                            : "M4 6h16M4 12h16M4 18h16" }) }) }))] }), _jsx("nav", { className: "flex-1 p-4 space-y-2 overflow-y-auto", children: menuItems.map((item) => (_jsxs(Link, { href: item.path, className: cn("flex items-center space-x-3 px-4 py-3 rounded-lg transition-colors", isActive(item.path, item.exact)
                                ? "bg-primary-50 dark:bg-primary-900/20 text-primary-600 dark:text-primary-400"
                                : "text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-700"), children: [_jsx("span", { className: "text-xl", children: item.icon }), sidebarOpen && _jsx("span", { className: "font-medium", children: item.label })] }, item.id))) }), _jsxs("div", { className: "p-4 border-t border-neutral-200 dark:border-neutral-700 flex-shrink-0 space-y-2", children: [_jsxs(Link, { href: "/admin/storage", className: cn("flex items-center space-x-3 px-4 py-3 rounded-lg transition-colors", isActive("/admin/storage")
                                    ? "bg-primary-50 dark:bg-primary-900/20 text-primary-600 dark:text-primary-400"
                                    : "text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-700"), children: [_jsx("span", { className: "text-xl", children: "\uD83D\uDCBE" }), sidebarOpen && (_jsx("span", { className: "font-medium", children: "Storage Settings" }))] }), _jsxs(Link, { href: "/", className: "flex items-center space-x-3 px-4 py-3 rounded-lg text-neutral-700 dark:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors", children: [_jsx("span", { className: "text-xl", children: "\uD83C\uDFE0" }), sidebarOpen && _jsx("span", { className: "font-medium", children: "View Site" })] }), onLogout && (_jsxs("button", { onClick: onLogout, className: "w-full flex items-center space-x-3 px-4 py-3 rounded-lg text-error-600 dark:text-error-400 hover:bg-error-50 dark:hover:bg-error-900/20 transition-colors", children: [_jsx("span", { className: "text-xl", children: "\uD83D\uDEAA" }), sidebarOpen && _jsx("span", { className: "font-medium", children: "Logout" })] }))] })] }), _jsx("main", { className: cn("flex-1 overflow-y-auto transition-all duration-300", sidebarOpen ? "ml-64" : "ml-20"), children: _jsx("div", { className: "container mx-auto px-6 py-8", children: children }) })] }));
};
export default AdminLayout;
