Merge remote-tracking branch 'origin/main' into navbar
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
export async function GET(request: Request) {
|
||||
return NextResponse.json({ message: 'Hello from Next.js API Route!' });
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const data = await request.json();
|
||||
return NextResponse.json({ message: 'Received POST request', data });
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { NextResponse, NextRequest } from 'next/server';
|
||||
// import type { NextApiRequestContext } from 'next';
|
||||
|
||||
import { cookies } from 'next/headers';
|
||||
import { productCategories } from '../../data';
|
||||
import images from '@/assets/images/images';
|
||||
|
||||
export async function GET(request: NextRequest, context: any) {
|
||||
const cookieStore = await cookies();
|
||||
const lang = cookieStore.get('lang')?.value || 'en';
|
||||
|
||||
const category = productCategories.find(
|
||||
(cat) => cat.id === context.params.id,
|
||||
);
|
||||
|
||||
if (!category) {
|
||||
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
||||
}
|
||||
const product = {
|
||||
title: 'Product title',
|
||||
size: 'W 18 * L10',
|
||||
imageSrc: '/product1.png',
|
||||
};
|
||||
const products = Array.from({ length: 10 }, () => product);
|
||||
|
||||
return NextResponse.json({
|
||||
data: products,
|
||||
});
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NextResponse, NextRequest } from 'next/server';
|
||||
// import type { NextApiRequestContext } from 'next';
|
||||
|
||||
import { cookies } from 'next/headers';
|
||||
import { productCategories } from '../data';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: { id: string } },
|
||||
) {
|
||||
export async function GET(request: NextRequest, context: any) {
|
||||
const cookieStore = await cookies();
|
||||
const lang = cookieStore.get('lang')?.value || 'en';
|
||||
|
||||
const category = productCategories.find((cat) => cat.id === params.id);
|
||||
const category = productCategories.find(
|
||||
(cat) => cat.id === context.params.id,
|
||||
);
|
||||
|
||||
if (!category) {
|
||||
return NextResponse.json({ error: 'Not found' }, { status: 404 });
|
||||
@@ -25,6 +26,10 @@ export async function GET(
|
||||
lang === 'fa' && category.fa_bestForTitle
|
||||
? category.fa_bestForTitle
|
||||
: category.bestForTitle;
|
||||
const descriptionData =
|
||||
lang === 'fa' && category.fa_description
|
||||
? category.fa_description
|
||||
: category.description;
|
||||
|
||||
return NextResponse.json({
|
||||
data: {
|
||||
@@ -34,6 +39,7 @@ export async function GET(
|
||||
title: titleData,
|
||||
priceTypeTitle: priceTypeTitleData,
|
||||
bestForTitle: bestForTitleData,
|
||||
description: descriptionData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,18 @@ export const productCategories = [
|
||||
fa_priceTypeTitle: 'اقتصادی',
|
||||
bestForTitle: 'Best For Interior Part',
|
||||
fa_bestForTitle: 'Best For Interior Part',
|
||||
fa_description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
@@ -20,6 +32,18 @@ export const productCategories = [
|
||||
fa_priceTypeTitle: 'لاکچری',
|
||||
bestForTitle: 'Best For Exterior Part',
|
||||
fa_bestForTitle: 'Best For Exterior Part',
|
||||
fa_description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
@@ -31,6 +55,18 @@ export const productCategories = [
|
||||
fa_priceTypeTitle: 'اقتصادی',
|
||||
bestForTitle: 'Best For Facing',
|
||||
fa_bestForTitle: 'Best For Facing',
|
||||
fa_description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
},
|
||||
{
|
||||
id: '40',
|
||||
@@ -42,6 +78,18 @@ export const productCategories = [
|
||||
fa_priceTypeTitle: 'اقتصادی',
|
||||
bestForTitle: 'Best For Building',
|
||||
fa_bestForTitle: 'Best For Building',
|
||||
fa_description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
description: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`,
|
||||
},
|
||||
] as APIProductCategoryEntity[];
|
||||
|
||||
@@ -55,4 +103,16 @@ interface APIProductCategoryEntity {
|
||||
fa_priceTypeTitle?: string;
|
||||
bestForTitle: string;
|
||||
fa_bestForTitle?: string;
|
||||
fa_description?: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`;
|
||||
description?: `Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
Facing Bricks: Characteristics and Features
|
||||
Facing bricks, also known as face bricks or veneer bricks, are specially designed for visible areas of a building, primarily the exterior facades, but also for interior walls where aesthetics are important. Unlike common bricks which are often covered by plaster or other materials, facing bricks are chosen for their visual appeal and ability to withstand environmental conditions.
|
||||
|
||||
Facing Bricks: Characteristics and Features`;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { productCategories } from './data';
|
||||
export async function GET(request: Request) {
|
||||
let data = productCategories;
|
||||
|
||||
const cookieStore = cookies();
|
||||
const cookieStore = await cookies();
|
||||
const lang = (await cookieStore).get('lang')?.value || 'fa';
|
||||
|
||||
if (lang === 'fa') {
|
||||
@@ -20,6 +20,8 @@ export async function GET(request: Request) {
|
||||
fa_priceTypeTitle,
|
||||
bestForTitle,
|
||||
fa_bestForTitle,
|
||||
description,
|
||||
fa_description,
|
||||
}) => {
|
||||
const titleData = lang === 'fa' && fa_title ? fa_title : title;
|
||||
const priceTypeTitleData =
|
||||
@@ -28,6 +30,8 @@ export async function GET(request: Request) {
|
||||
: priceTypeTitle;
|
||||
const bestForTitleData =
|
||||
lang === 'fa' && fa_bestForTitle ? fa_bestForTitle : bestForTitle;
|
||||
const descriptionData =
|
||||
lang === 'fa' && fa_description ? fa_description : description;
|
||||
return {
|
||||
id,
|
||||
icon,
|
||||
@@ -35,6 +39,7 @@ export async function GET(request: Request) {
|
||||
title: titleData,
|
||||
priceTypeTitle: priceTypeTitleData,
|
||||
bestForTitle: bestForTitleData,
|
||||
description: descriptionData,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
+40
-1
@@ -106,10 +106,19 @@
|
||||
}
|
||||
|
||||
* {
|
||||
|
||||
font-family: 'Manrope';
|
||||
}
|
||||
|
||||
html{
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
@media (width <=48rem) {
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
:root {
|
||||
--primary: #FA003F;
|
||||
@@ -185,3 +194,33 @@
|
||||
padding-inline: 8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.container-fluid {
|
||||
width: 100%;
|
||||
padding-inline: 1rem;
|
||||
|
||||
@media (width >=40rem) {
|
||||
max-width: 100%;
|
||||
padding-inline: 1rem;
|
||||
}
|
||||
|
||||
@media (width >=48rem) {
|
||||
max-width: 100%;
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
|
||||
@media (width >=64rem) {
|
||||
max-width: 100%;
|
||||
padding-inline: 2rem;
|
||||
}
|
||||
|
||||
@media (width >=80rem) {
|
||||
max-width: 100%;
|
||||
padding-inline: 3rem;
|
||||
}
|
||||
|
||||
@media (width >=96rem) {
|
||||
max-width: 100%;
|
||||
padding-inline: 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,55 @@
|
||||
import routeFactory from '@/assets/constants/routeFactory';
|
||||
import images from '@/assets/images/images';
|
||||
import Breadcrumb from '@/components/layout/breadcrumb';
|
||||
import { IBreadcrumbItem } from '@/components/layout/breadcrumb/breadcrumb';
|
||||
import InnerPageBanner from '@/components/layout/innerPages/banner';
|
||||
import ProductCategoryCardInProducts from '@/components/pages/productCategories/ProductCategoryCardInProducts';
|
||||
import ProductCard from '@/components/pages/products/ProductCard';
|
||||
import { getProductCategoryById } from '@/services/products';
|
||||
import { getProductCategoryById, getProducts } from '@/services/products';
|
||||
|
||||
interface IParams {
|
||||
product_category_id: string;
|
||||
}
|
||||
|
||||
export default async function ProductPage({
|
||||
params,
|
||||
}: {
|
||||
params: { product_category_id: string };
|
||||
params: Promise<IParams>;
|
||||
}) {
|
||||
const { product_category_id: productCategoryId } = params;
|
||||
const { product_category_id: productCategoryId } = await params;
|
||||
|
||||
const productCategory = await getProductCategoryById(productCategoryId);
|
||||
const products = await getProducts(productCategoryId);
|
||||
|
||||
const breadcrumbItems = [
|
||||
{
|
||||
...routeFactory.productCategories,
|
||||
href: routeFactory.productCategories.route(),
|
||||
},
|
||||
{ title: productCategory.title },
|
||||
] as IBreadcrumbItem[];
|
||||
|
||||
const product = {
|
||||
title: 'Product title',
|
||||
size: 'W 18 * L10',
|
||||
imageSrc: images.product1.src,
|
||||
};
|
||||
const products = Array.from({ length: 10 }, () => product);
|
||||
return (
|
||||
<main className="">
|
||||
<InnerPageBanner
|
||||
title={productCategory.title}
|
||||
imageSrc={images.homeProductBack.src}
|
||||
/>
|
||||
<div className="container mx-auto my-24">
|
||||
<div className="grid grid-cols-4 gap-3">
|
||||
{products.map((product, index) => (
|
||||
<ProductCard {...product} key={index} />
|
||||
))}
|
||||
<div className="container-fluid mx-auto my-24">
|
||||
<Breadcrumb items={breadcrumbItems} />
|
||||
<ProductCategoryCardInProducts
|
||||
productCategory={productCategory}
|
||||
className="mt-6"
|
||||
/>
|
||||
<div className="mt-20">
|
||||
<h2 className="mb-6 text-3xl font-semibold text-gray-500">
|
||||
{productCategory.title} Products
|
||||
</h2>
|
||||
<div className="grid gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5">
|
||||
{products.map((product, index) => (
|
||||
<ProductCard {...product} key={index} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -12,11 +12,11 @@ export default async function ProductsPage() {
|
||||
return (
|
||||
<main>
|
||||
<InnerPageBanner
|
||||
title={t('pages_projects_title') as string}
|
||||
title={t('pages_product_categories_title') as string}
|
||||
imageSrc={images.aboutBanner.src}
|
||||
/>
|
||||
<div className="container mx-auto my-24">
|
||||
<div className="grid w-full grid-cols-4 gap-4">
|
||||
<div className="container-fluid mx-auto my-24">
|
||||
<div className="grid w-full grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
{productCategories.map((category) => (
|
||||
<ProductsCategoryCard key={category.id} {...category} />
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user