Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14 categories #20

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Banner from "@/components/Banner";
import Categories from "@/components/Categories";

export default function Home() {
return (
<main>
<Banner />
<Categories />
</main>
);
}
21 changes: 21 additions & 0 deletions src/components/Categories/CategoryCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Image from "next/image";
import Link from "next/link";
import { FC } from "react";

interface CategoryCardProps {
image: string;
name: string;
}

const CategoryCard: FC<CategoryCardProps> = ({ image, name }) => {
return (
<div className="flex flex-col items-center justify-center gap-x-4 relative group">
<Link href={"https://actualizatucarro.mercadoshops.com.co/"}>
<Image src={image} width={150} height={150} alt={name} />
<span className="font-bold text-sm md:text-lg">{name}</span>
<div className="absolute h-1 bg-primary-lm bottom-[-5px] transform scale-x-0 group-hover:scale-x-100 transition-transform duration-200 ease-in-out w-full rounded"></div>
</Link>
</div>
);
};
export default CategoryCard;
19 changes: 19 additions & 0 deletions src/components/Categories/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { FC } from "react";
import CategoryCard from "./CategoryCard";

import { CATEGORIES } from "@/utils/constants";

const Categories: FC = () => {
return (
<section className="grid grid-cols-4 ms:grid-cols-8 px-2 py-6 max-w-f-hd mx-auto place-items-center gap-y-3">
{CATEGORIES.map((category) => (
<CategoryCard
image={category.image}
name={category.name}
key={category.name}
/>
))}
</section>
);
};
export default Categories;
42 changes: 42 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export const CATEGORIES = [
{
id: "74ee7f33-36c0-4446-8eb2-a18c64c2fab3",
image: "/images/categories/audio.webp",
name: "Audio",
},
{
id: "c75457bc-23c3-46e9-acde-73bf6ff126b4",
image: "/images/categories/bombillos.webp",
name: "Bombillos",
},
{
id: "6afe0153-7240-4cfc-bda6-09e08dc01031",
image: "/images/categories/exploradoras.webp",
name: "Exploradoras",
},
{
id: "a0842546-e4bb-4a7a-bee0-0a81512885e3",
image: "/images/categories/exterior.webp",
name: "Exterior",
},
{
id: "07b25b9c-fafc-4fa4-8621-3a1d7c0488c5",
image: "/images/categories/farolas.webp",
name: "Farolas",
},
{
id: "ee3c96c4-03d9-40c9-81c0-d94b97aa7178",
image: "/images/categories/interior.webp",
name: "Interior",
},
{
id: "509af101-457a-4a8d-877d-efcc5d9f6250",
image: "/images/categories/repuestos.webp",
name: "Repuestos",
},
{
id: "b826f6be-d561-4a2f-b4ca-4f50d8837c06",
image: "/images/categories/stops.webp",
name: "Stops",
},
];
Loading