feat: перенос vin в компоненты, добавление логики и исправления

This commit is contained in:
egortriston
2025-06-27 17:31:48 +03:00
parent 855018bd6c
commit c5470df33e
93 changed files with 9449 additions and 1829 deletions

74
src/pages/vin.tsx Normal file
View File

@ -0,0 +1,74 @@
import Head from "next/head";
import Header from "@/components/Header";
import Footer from "@/components/Footer";
import CatalogSubscribe from "@/components/CatalogSubscribe";
import MobileMenuBottomSection from "@/components/MobileMenuBottomSection";
import InfoVin from "@/components/vin/InfoVin";
import VinLeftbar from "@/components/vin/VinLeftbar";
import VinCategory from "@/components/vin/VinCategory";
import VinKnot from "@/components/vin/VinKnot";
import React, { useState } from "react";
export default function Vin() {
const [showKnot, setShowKnot] = useState(false);
// Обработчик для передачи в VinCategory и для делегирования на .link-2
const handleCategoryClick = (e?: React.MouseEvent) => {
if (e) e.preventDefault();
setShowKnot(true);
};
React.useEffect(() => {
// Делегируем клик на все .link-2 (если они есть на странице)
const handler = (e: Event) => {
const target = e.target as HTMLElement;
if (target.classList.contains("link-2")) {
e.preventDefault();
setShowKnot(true);
}
};
document.addEventListener("click", handler);
return () => document.removeEventListener("click", handler);
}, []);
return (
<>
<Head>
<title>VIN</title>
<meta content="vin" property="og:title" />
<meta content="vin" property="twitter:title" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="Webflow" name="generator" />
<link href="/css/normalize.css" rel="stylesheet" type="text/css" />
<link href="/css/webflow.css" rel="stylesheet" type="text/css" />
<link href="/css/protekproject.webflow.css" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com" rel="preconnect" />
<link href="https://fonts.gstatic.com" rel="preconnect" crossOrigin="anonymous" />
<link href="images/favicon.png" rel="shortcut icon" type="image/x-icon" />
<link href="images/webclip.png" rel="apple-touch-icon" />
</Head>
<InfoVin />
<section className="main">
<div className="w-layout-blockcontainer container-vin w-container">
<div className="w-layout-hflex flex-block-13">
<VinLeftbar />
{/* Категории или Knot */}
{showKnot ? (
<VinKnot />
) : (
<VinCategory onCategoryClick={handleCategoryClick} />
)}
</div>
</div>
</section>
<section className="section-3">
<CatalogSubscribe />
</section>
<Footer />
<MobileMenuBottomSection />
</>
);
}