Skip to content

Commit

Permalink
Adding the product card componets
Browse files Browse the repository at this point in the history
This commit add the product UI card that will be used to list product in a grid system on the homepage and archive pages
  • Loading branch information
bertrandshema committed Jun 23, 2024
1 parent 84ed4a5 commit 5d076ed
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"dotenv": "^16.4.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.23.1",
"redux": "^5.0.1"
Expand Down
53 changes: 53 additions & 0 deletions src/components/productCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { Link } from 'react-router-dom';
import { FiPlus } from 'react-icons/fi';
import { FaRegHeart } from 'react-icons/fa';

function ProductCard() {
return (
<div className="product-card rounded-md shadow-md ">
<div className="card-img-container w-full">
<img
src="https://teddybusinessgroup.com/wp-content/uploads/2023/11/32A4G-1-300x300.webp"
alt="product"
className="product-card-img rounded-t-md w-full"
/>
<span className="p-2 bg-red-600 text-white font-normal rounded-lg text-xs">
10% Off
</span>
</div>
<div className="card-content p-4">
<div className="flex">
<Link to="/">
<h3 className="text-xl">Product name</h3>
</Link>

<button
type="button"
aria-label="addToWishlist"
className="rounded p-2.5 bg-gray-400 text-black"
>
<FaRegHeart />
</button>
</div>
<p>Ullamco tempor duis mollit ullamco incididunt culpa elit commodo.</p>
<div className="flex">
<span className="text-sm">4.7</span>
</div>
<div className="flex">
<p className="text-2xl font-bold text-red-600">
$12,099
<span className="text-sm font-normal text-black">$18,999</span>
</p>
<button
type="button"
aria-label="addToCart"
className="rounded p-2.5 bg-violet-800 text-white"
>
<FiPlus />
</button>
</div>
</div>
</div>
);
}
export default ProductCard;
8 changes: 7 additions & 1 deletion src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import ProductCard from '@/components/productCard';

function Home() {
return <p className="text-blueBg">Welcome to Dynamites E-commerce</p>;
return (
<div className="container mx-auto grid grid-cols-4 gap-4">
<ProductCard />
</div>
);
}

export default Home;

0 comments on commit 5d076ed

Please sign in to comment.