Files
spestexnika/components/pageParts/products.tsx
2025-10-04 18:09:32 +05:00

62 lines
2.0 KiB
TypeScript

"use client";
import React, { useState } from "react";
import Title from "../tools/title";
import Text from "../text";
import { Asphalt, Ekskavator, Forklift, Kran, Truck } from "@/assets";
import Image from "next/image";
import type {productFilterTypes} from "@/types";
const productFilterTypes: productFilterTypes[] = [
{ name: "trucks", image: Truck },
{ name: "cranes", image: Kran },
{ name: "forklift-trucks", image: Ekskavator },
{ name: "excavators", image: Forklift },
{ name: "road-repairs", image: Asphalt },
];
export default function Products() {
//product type togle states
const [productFilter, setProductFilter] = useState<string | null>(null);
return (
<div>
{/* title part */}
<div className="flex flex-col md:gap-8 gap-4">
<div className="flex items-center justify-center w-full ">
<div className="text-secondary px-2 py-1 text-[18px] font-semibold ">
<Text txt="equipment" />
</div>
<div className="bg-primary text-secondary px-3 py-1 text-[18px] font-semibold ">
<Text txt="amazing" />
</div>
</div>
<Title text="pricing-h2" />
</div>
{/* product filters */}
<div className="flex flex-wrap gap-3 items-center justify-center">
{productFilterTypes.map((item, index) => (
<button
key={index}
onClick={() => setProductFilter(item.name)}
className={`${
productFilter === item.name ? "bg-secondary" : ""
} flex items-center gap-2 hover:bg-secondary border-gray-300 hover:border-secondary border-[1px] px-8 py-3 text-2xl rounded-tr-full rounded-bl-full `}
>
<Text txt={item.name} />
<Image
src={item.image}
alt="Truck images"
width={50}
height={50}
/>
</button>
))}
</div>
{/* products */}
<div></div>
</div>
);
}