Skip to content

Commit

Permalink
Merge pull request #10 from 202306-NEA-DZ-FEW/8-feature-shopping-card
Browse files Browse the repository at this point in the history
feat(shoppingcard component): create a reusable card component
  • Loading branch information
hocine1212 authored Sep 28, 2023
2 parents 4259e8d + 48a969e commit 709a6d4
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 3 deletions.
105 changes: 105 additions & 0 deletions package-lock.json

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

37 changes: 37 additions & 0 deletions src/components/ShoppingCard/ShoppingCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Link from "next/link"
import StarRating from "../Rating/StarRating"

export default function ShoppingCard({ product }) {
return (
<Link href={`/products/${product.id}`}>
<div
className="card w-90 bg-white glass border-gold-g "
style={{ minHeight: "450px" }}
key={product.id}
>
<figure>
<img
src={product.image}
alt={product.title}
style={{ width: "60%", height: "250px", padding: "1rem" }}
/>
</figure>
<div className="card-body text-center">
<h2 className="card-title text-text-brown mb-2 ">
{product.title.length > 25
? `${product.title.slice(0, 25)}...`
: product.title}
</h2>
<StarRating rating={product.rating.rate} />

<div className="flex flex-wrap items-start gap-16 ">
<button className="btn bg-buttongold text-brown-text-brown px-4 py-2 hover:bg-buttongoldhov border border-brown-100 btn-xs sm:btn-sm md:btn-sm lg:btn-sm">
add to cart
</button>
<p className="font-bold text-xl">{product.price}$</p>
</div>
</div>
</div>
</Link>
)
}
File renamed without changes.
9 changes: 8 additions & 1 deletion src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import Filter from "@/components/Filter/Filter"
import Image from "next/image"
import AllProducts from "./products"

export default function Home() {
return <h1>hi</h1>
return (
<>
{/* <Filter /> */}
<AllProducts />
</>
)
}
4 changes: 2 additions & 2 deletions src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@tailwind components;
@tailwind utilities;

:root {
/* :root {
--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
--background-end-rgb: 255, 255, 255;
Expand All @@ -24,4 +24,4 @@ body {
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
}
} */
Empty file added src/util/API.js
Empty file.

0 comments on commit 709a6d4

Please sign in to comment.