-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
193 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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,96 @@ | ||
.container { | ||
max-width: 800px; | ||
margin: 0 auto; | ||
padding: 20px; | ||
} | ||
|
||
.cart-title { | ||
text-align: center; | ||
font-size: 32px; | ||
margin-bottom: 20px; | ||
font-family: 'Times New Roman', Times, serif; | ||
|
||
} | ||
|
||
.cart-paper { | ||
background-color: #f9f9f9; | ||
padding: 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.cart-heading { | ||
font-size: 24px; | ||
font-weight: bold; | ||
margin-bottom: 10px; | ||
font-family: 'Times New Roman', Times, serif; | ||
|
||
} | ||
|
||
.wishlist-items { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 3rem; | ||
max-height: 600px; | ||
overflow-y: auto; | ||
} | ||
|
||
.wishlist-item { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
background-color: #fff; | ||
padding: 10px; | ||
border-radius: 5px; | ||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.wishlist-details { | ||
display: flex; | ||
flex-direction: column; | ||
font-family: 'Times New Roman', Times, serif; | ||
} | ||
|
||
.wishlist-name { | ||
font-weight: bold; | ||
font-size: 24px; | ||
} | ||
|
||
.wishlist-category | ||
{ | ||
font-size: 16px; | ||
color: #555; | ||
} | ||
|
||
.wishlist-color { | ||
color: #777; | ||
} | ||
|
||
.remove-btn { | ||
background-color: #a10d0d; | ||
color: #fff; | ||
border: none; | ||
padding: 8px 12px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
.remove-btn:hover { | ||
background-color: #ff4646; | ||
} | ||
|
||
.go-back { | ||
display: block; | ||
text-align: center; | ||
background-color:hsl(288, 100%, 64%) ; | ||
color: #fff; | ||
text-decoration: none; | ||
padding: 10px 20px; | ||
border-radius: 5px; | ||
margin-top: 20px; | ||
} | ||
|
||
.go-back:hover { | ||
background-color: hsl(276, 100%, 64%); | ||
} |
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,56 @@ | ||
import React from "react"; | ||
import "./WishList.css"; | ||
import {Link} from 'react-router-dom'; | ||
const WishList = ({wishlist,onRemoveItem}) => { | ||
const isEmpty =wishlist.length===0; | ||
|
||
const EmptyCart = () => { | ||
return ( | ||
<> | ||
<div className="alert"> | ||
You have no items in your WishList, start adding some! | ||
</div> | ||
<Link to="/" className="button go-back"> | ||
Go Back | ||
</Link> | ||
</> | ||
); | ||
}; | ||
const handleRemoveItem = (id) => { | ||
onRemoveItem(id); | ||
}; | ||
const FilledWishList = () => { | ||
return ( | ||
<div className="wishlist-items"> | ||
{wishlist.map((item) => ( | ||
<div key={item.id} className="wishlist-item"> | ||
<div className="wishlist-details"> | ||
<div className="wishlist-name">{item.name}</div> | ||
<div className="wishlist-category">Category: {item.category}</div> | ||
<div className="wishlist-color">Color: {item.color}</div> | ||
</div> | ||
<button onClick={() => handleRemoveItem(item.id)} className="remove-btn"> | ||
Remove | ||
</button> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
return ( | ||
<div className="container"> | ||
<h3 className="cart-title">Your WishList</h3> | ||
<div className="cart-grid"> | ||
<div className="cart-items-container"> | ||
<div className="cart-paper"> | ||
<h5 className="cart-heading">Added Items</h5> | ||
<hr className="divider" /> | ||
{isEmpty ? <EmptyCart /> : <FilledWishList />} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default WishList; |
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