index.js
1.6 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
import { useRouter } from "next/router";
import Breadcrumb from "@/components/Common/Breadcrumb";
import HeadTitle from "@/components/Common/HeadTitle";
import InnerDetailsSubCategory from "@/components/Collection/InnerDetailsSubCategory";
import { collectionsData } from "@/pages/data/collectionsData";
const SubCategoryPage = () => {
const router = useRouter();
const { category, subCategory } = router.query;
console.log('subCategory',subCategory)
if (!router.isReady) return null;
const categoryData = collectionsData.find(
item => item.categorySlug === category
);
const subCategoryData = categoryData?.subCategories.find(
sub => sub.subCategorySlug === subCategory
);
// console.log("subCategoryData666", subCategoryData)
if (!categoryData || !subCategoryData) {
return <h1>Sub Category not found</h1>;
}
const breadcrumbData = [
{ href: "/collections", label: "Collections" },
{
href: `/collections/${category}`,
label: categoryData.categoryName,
},
{
href: `/collections/${category}/${subCategory}`,
label: subCategoryData.subCategoryName,
},
];
const headTitleData = {
title: subCategoryData.subCategoryName,
descrition1: "The Akruti Lux Collection brings together iconic brands, bespoke designs, ",
descrition2: "and architectural excellence—crafted to inspire refined living.",
};
return (
<>
<Breadcrumb breadcrumbData={breadcrumbData} />
<HeadTitle headTitleData={headTitleData} />
<InnerDetailsSubCategory products={subCategoryData.products} />
</>
);
};
export default SubCategoryPage;