-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1545 from hngprojects/delete-button
Feat: Implement the "Delete" Button on Product Card being displayed on the Grid page of Product Listing
- Loading branch information
Showing
10 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
src/app/dashboard/(user-dashboard)/products/_components/new-product-modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/app/dashboard/(user-dashboard)/products/_components/product-detail-modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/app/dashboard/(user-dashboard)/products/_components/productcadrcomponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"use client"; | ||
|
||
import Image, { StaticImageData } from "next/image"; | ||
|
||
interface ProductCardProperties { | ||
title: string; | ||
price: string; | ||
description: string; | ||
inStock: boolean; | ||
imageUrl: string | StaticImageData; | ||
} | ||
|
||
const Delete = () => { | ||
alert("Are you sure you want to delete"); | ||
}; | ||
|
||
const Edit = () => { | ||
alert("Proceed to edit"); | ||
}; | ||
|
||
const ProductCard: React.FC<ProductCardProperties> = ({ | ||
title, | ||
price, | ||
description, | ||
inStock, | ||
imageUrl, | ||
}) => { | ||
return ( | ||
<div className="max-w-sm overflow-hidden rounded-md border-[1px] border-[#D9D9D9] bg-white p-3 shadow-md"> | ||
<Image | ||
src={imageUrl} | ||
alt={title} | ||
width={400} | ||
height={300} | ||
className="h-48 w-full rounded-md object-cover" | ||
/> | ||
<div className="p-4"> | ||
<div className="flex items-center justify-between"> | ||
<h2 className="text-xl font-bold">{title}</h2> | ||
<p className="mt-1 text-[20px] font-bold text-gray-900">{price}</p> | ||
</div> | ||
<p className="mb-4 text-base text-gray-700">{description}</p> | ||
<span | ||
className={`mt-3 px-5 py-2 text-sm ${inStock ? "rounded-full bg-[#E7F7E9] text-green-500" : "bg-[#FDE7E7] text-red-500"}`} | ||
> | ||
{inStock ? "In stock" : "Out of stock"} | ||
</span> | ||
<div className="mt-6 flex justify-between space-x-2"> | ||
<button | ||
onClick={Edit} | ||
className="w-[130px] rounded-md border-[1px] px-4 py-2 text-black" | ||
> | ||
Edit | ||
</button> | ||
<button | ||
onClick={Delete} | ||
className="w-[130px] rounded-md border-[1px] bg-white px-4 py-2 text-[#DC2626]" | ||
> | ||
Delete | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProductCard; |
Oops, something went wrong.