ceo optimization
This commit is contained in:
@@ -19,7 +19,7 @@ export function ProductCard({ product }: ProductCardProps) {
|
||||
const setProducts = useProduct((state) => state.setProducts);
|
||||
return (
|
||||
<Link
|
||||
href={`/detail?${languageIndex ? product.name_uz : product.name_ru}`}
|
||||
href={`/product/${product.slug}`}
|
||||
onClick={() => {
|
||||
setProductName(languageIndex ? product.name_uz : product.name_ru);
|
||||
setProducts(product);
|
||||
@@ -63,14 +63,14 @@ export function ProductCard({ product }: ProductCardProps) {
|
||||
</p>
|
||||
|
||||
{/* CTA Button - Always at Bottom */}
|
||||
<motion.button
|
||||
<motion.div
|
||||
whileHover={{ scale: 1.02 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
className="w-full flex items-center justify-center gap-2 px-6 py-3 bg-primary text-white rounded-xl font-semibold shadow-lg shadow-blue-500/30 hover:shadow-xl hover:shadow-primary/40 transition-all duration-300 group/button"
|
||||
>
|
||||
<span>{t.details}</span>
|
||||
<ExternalLink className="w-4 h-4 group-hover/button:translate-x-1 transition-transform duration-300" />
|
||||
</motion.button>
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
{/* Decorative Corner */}
|
||||
|
||||
@@ -11,6 +11,8 @@ import { ProductCard } from "./ProductCard";
|
||||
import axios from "axios";
|
||||
import EmptyState from "../productsPage/emptyData";
|
||||
import Loading from "../loading";
|
||||
import { getAllProducts } from "@/lib/api";
|
||||
import { generateSlug } from "@/lib/slug";
|
||||
|
||||
// hello everyone
|
||||
|
||||
@@ -22,14 +24,14 @@ export function ProductsGrid() {
|
||||
useEffect(() => {
|
||||
async function getData() {
|
||||
setLoading(true);
|
||||
await axios
|
||||
.get("https://admin.promtechno.uz/api/products/")
|
||||
.then((res) => {
|
||||
console.log("all data main page: ", res?.data);
|
||||
const allData = res?.data || [];
|
||||
setAllProducts(allData.slice(0, 3));
|
||||
setLoading(false);
|
||||
});
|
||||
const products = await getAllProducts();
|
||||
setAllProducts(
|
||||
products.map((product: any) => ({
|
||||
...product,
|
||||
slug: generateSlug(product.name_uz),
|
||||
})).slice(0, 3)
|
||||
);
|
||||
setLoading(false);
|
||||
}
|
||||
getData();
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user