base commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { Link, useLocation } from 'react-router';
|
||||
import { Settings, MapPin, ShoppingBag, MessageSquare } from 'lucide-react';
|
||||
|
||||
const navItems = [
|
||||
{ path: '/account/settings', label: 'Настройки', icon: Settings },
|
||||
{ path: '/account/addresses', label: 'Адреса', icon: MapPin },
|
||||
{ path: '/account/orders', label: 'Заказы', icon: ShoppingBag },
|
||||
{ path: '/account/messages', label: 'Сообщения', icon: MessageSquare }
|
||||
];
|
||||
|
||||
export function AccountSidebar() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<aside className="w-64 bg-card border-r border-border min-h-[calc(100vh-5rem)] p-6">
|
||||
<h2 className="mb-8 text-xl text-foreground">Личный кабинет</h2>
|
||||
|
||||
<nav className="space-y-2">
|
||||
{navItems.map(item => {
|
||||
const Icon = item.icon;
|
||||
const isActive = location.pathname === item.path;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
className={`flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 ${
|
||||
isActive
|
||||
? 'bg-primary text-primary-foreground shadow-md'
|
||||
: 'text-muted-foreground hover:bg-muted hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
<Icon className="w-5 h-5" />
|
||||
<span className="text-sm">{item.label}</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { Link, useLocation } from 'react-router';
|
||||
import { LayoutDashboard, ShoppingBag, Star, Users, FileText } from 'lucide-react';
|
||||
|
||||
const navItems = [
|
||||
{ path: '/admin', label: 'Dashboard', icon: LayoutDashboard },
|
||||
{ path: '/admin/orders', label: 'Заказы', icon: ShoppingBag },
|
||||
{ path: '/admin/reviews', label: 'Отзывы', icon: Star },
|
||||
{ path: '/admin/users', label: 'Пользователи', icon: Users },
|
||||
{ path: '/admin/info', label: 'Информация', icon: FileText }
|
||||
];
|
||||
|
||||
export function AdminSidebar() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<aside className="w-64 bg-card border-r border-border min-h-screen p-6">
|
||||
<Link to="/admin" className="block mb-8">
|
||||
<h2 className="text-xl text-foreground">Админ-панель</h2>
|
||||
</Link>
|
||||
|
||||
<nav className="space-y-2">
|
||||
{navItems.map(item => {
|
||||
const Icon = item.icon;
|
||||
const isActive = location.pathname === item.path;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
className={`flex items-center gap-3 px-4 py-3 rounded-xl transition-all duration-200 ${
|
||||
isActive
|
||||
? 'bg-primary text-primary-foreground shadow-md'
|
||||
: 'text-muted-foreground hover:bg-muted hover:text-foreground'
|
||||
}`}
|
||||
>
|
||||
<Icon className="w-5 h-5" />
|
||||
<span className="text-sm">{item.label}</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import { Link } from 'react-router';
|
||||
import { ShoppingCart, User, Menu, Search } from 'lucide-react';
|
||||
|
||||
interface HeaderProps {
|
||||
cartCount?: number;
|
||||
}
|
||||
|
||||
export function Header({ cartCount = 0 }: HeaderProps) {
|
||||
return (
|
||||
<header className="sticky top-0 z-50 bg-card border-b border-border shadow-sm">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div className="flex items-center justify-between h-20">
|
||||
<div className="flex items-center gap-8">
|
||||
<Link to="/" className="flex items-center">
|
||||
<h1 className="text-2xl tracking-tight text-foreground">Craftshop</h1>
|
||||
</Link>
|
||||
|
||||
<nav className="hidden md:flex items-center gap-6">
|
||||
<Link to="/" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
|
||||
Каталог
|
||||
</Link>
|
||||
<Link to="/info" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
|
||||
О нас
|
||||
</Link>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<button className="p-2 text-muted-foreground hover:text-foreground transition-colors">
|
||||
<Search className="w-5 h-5" />
|
||||
</button>
|
||||
|
||||
<Link to="/account/settings" className="p-2 text-muted-foreground hover:text-foreground transition-colors">
|
||||
<User className="w-5 h-5" />
|
||||
</Link>
|
||||
|
||||
<Link to="/cart" className="relative p-2 text-muted-foreground hover:text-foreground transition-colors">
|
||||
<ShoppingCart className="w-5 h-5" />
|
||||
{cartCount > 0 && (
|
||||
<span className="absolute -top-1 -right-1 w-5 h-5 bg-primary text-primary-foreground text-xs rounded-full flex items-center justify-center">
|
||||
{cartCount}
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
|
||||
<button className="md:hidden p-2 text-muted-foreground hover:text-foreground transition-colors">
|
||||
<Menu className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user