From 1430cbd25b70f789ae94927154e8d962863a6e5f Mon Sep 17 00:00:00 2001 From: belikovme Date: Thu, 27 Feb 2025 17:27:49 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D1=8B=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=20=D1=81=20=D1=83?= =?UTF-8?q?=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=BD=D1=8B=D0=BC=20=D0=B4?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D0=B9=D0=BD=D0=BE=D0=BC=20=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D1=80=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Collections.tsx | 75 +++---- components/Header.tsx | 56 +++-- components/Hero.tsx | 164 +++++---------- components/NewArrivals.tsx | 313 ++++++++++++++++++++-------- components/PopularCategories.tsx | 69 +++---- data/categories.ts | 87 ++++++++ data/collections.ts | 63 ++++++ data/products.ts | 170 ++++++++++++++++ pages/category/[slug].tsx | 170 ++++++++++++++++ pages/category/index.tsx | 1 + pages/collections/[slug].tsx | 205 +++++++++++++++++++ pages/collections/index.tsx | 73 +++++++ pages/index.tsx | 149 +------------- pages/product/[slug].tsx | 338 +++++++++++++++++++++++++++++++ styles/globals.css | 10 + 15 files changed, 1499 insertions(+), 444 deletions(-) create mode 100644 data/categories.ts create mode 100644 data/collections.ts create mode 100644 data/products.ts create mode 100644 pages/category/[slug].tsx create mode 100644 pages/category/index.tsx create mode 100644 pages/collections/[slug].tsx create mode 100644 pages/collections/index.tsx create mode 100644 pages/product/[slug].tsx diff --git a/components/Collections.tsx b/components/Collections.tsx index 50f2341..00039c0 100644 --- a/components/Collections.tsx +++ b/components/Collections.tsx @@ -1,63 +1,46 @@ -import { motion } from 'framer-motion'; -import Image from 'next/image'; -import Link from 'next/link'; +import Image from "next/image" +import Link from "next/link" +import { motion } from "framer-motion" +import { Collection } from "../data/collections" -// Типы для свойств компонента interface CollectionsProps { - collections: Collection[]; -} - -// Тип для коллекции -interface Collection { - id: number; - name: string; - image: string; - description: string; - url: string; + collections: Collection[] } export default function Collections({ collections }: CollectionsProps) { return ( -
-
- - Коллекции - - -
- {collections.map((collection, index) => ( +
+

Коллекции

+ +
+ {collections.map((collection, index) => ( + - -
- {collection.name} -
-
+
+ {collection.name} +
-

{collection.name}

-

{collection.description}

+

{collection.name}

+

{collection.description}

+ + Смотреть коллекцию +
- +
- ))} -
+ + ))}
- ); + ) } \ No newline at end of file diff --git a/components/Header.tsx b/components/Header.tsx index 2aa4928..21fbd7c 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,10 +1,12 @@ import Link from "next/link"; -import { Search, Heart, User, ShoppingCart } from "lucide-react"; +import { Search, Heart, User, ShoppingCart, ChevronLeft } from "lucide-react"; import { useState, useEffect } from "react"; import { motion } from "framer-motion"; import Image from "next/image"; +import { useRouter } from "next/router"; export default function Header() { + const router = useRouter(); // Состояние для отслеживания прокрутки страницы const [scrolled, setScrolled] = useState(false); @@ -23,33 +25,57 @@ export default function Header() { }; }, [scrolled]); + // Функция для возврата на предыдущую страницу + const goBack = () => { + router.back(); + }; + + // Проверяем, находимся ли мы на главной странице + const isHomePage = router.pathname === "/"; + // Проверяем, находимся ли мы на странице категорий или коллекций + const isDetailPage = router.pathname.includes("[slug]"); + return ( -
-