[slug].js
1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { useRouter } from "next/router";
import Breadcrumb from "@/components/Common/Breadcrumb";
import { brandsData } from "@/pages/data/brandsData";
import InnerBannerBrands from "@/components/Brands/InnerBannerBrands";
import AboutInfoBrands from "@/components/Brands/AboutInfoBrands";
import Video from "@/components/Brands/Video";
import TechnicalDetails from "@/components/Brands/TechnicalDetails";
import Gallery from "@/components/Collection/Gallery";
import Explore from "@/components/Brands/Explore";
import { Contact } from "@/container/Home/Contact";
const BrandDetailsPage = () => {
const router = useRouter();
const { category, slug } = router.query;
if (!router.isReady) return null;
const categoryData = brandsData.find(
item => item.categorySlug === category
);
const subCategoryData = categoryData?.subCategories.find(
sub => sub.subCategorySlug === slug
);
if (!categoryData || !subCategoryData) {
return <h1>Details not found</h1>;
}
const breadcrumbData=[
{ href: "/brands", label: "Brands" },
{ href: `/brands/${category}`, label: categoryData.categoryName },
{ href: router.asPath, label: subCategoryData.subCategoryName },
]
return (
<>
<Breadcrumb breadcrumbData={breadcrumbData} />
<InnerBannerBrands subCategoryData={subCategoryData || []} />
<AboutInfoBrands />
<Video />
<TechnicalDetails />
<Gallery />
<Explore />
<Contact />
{/* <h1>{subCategoryData.subCategoryName}</h1>
<img
src={subCategoryData.subCategoryImage}
alt={subCategoryData.subCategoryName}
style={{ maxWidth: "400px" }}
/> */}
</>
);
};
export default BrandDetailsPage;