mirror of
https://github.com/Shchoholiev/shopping-assistant-web-client.git
synced 2025-04-11 01:18:50 +00:00
SA-55 add cart page
This commit is contained in:
parent
2562405668
commit
16fd49af3f
@ -2,9 +2,99 @@
|
|||||||
@model ShoppingAssistantWebClient.Web.Pages.CartModel
|
@model ShoppingAssistantWebClient.Web.Pages.CartModel
|
||||||
@{
|
@{
|
||||||
}
|
}
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.product-div {
|
||||||
|
height: 310px;
|
||||||
|
width: 200px;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
position: relative;
|
||||||
|
padding: 0 10px 0 10px;
|
||||||
|
margin: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-img {
|
||||||
|
height: 130px;
|
||||||
|
width: 100%;
|
||||||
|
align-self: center;
|
||||||
|
display: block;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
.product-description {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.button-amazon {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #009FFF;
|
||||||
|
border: none;
|
||||||
|
border-radius: 10px;
|
||||||
|
position: absolute;
|
||||||
|
width: 90%;
|
||||||
|
height: 40px;
|
||||||
|
bottom: 10px;
|
||||||
|
}
|
||||||
|
.star {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 60px;
|
||||||
|
}
|
||||||
|
.rating {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 60px;
|
||||||
|
left: 35px;
|
||||||
|
height: 16px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.button-row {
|
||||||
|
display: flex;
|
||||||
|
align-items:
|
||||||
|
}
|
||||||
|
.price-label {
|
||||||
|
position: absolute;
|
||||||
|
right: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: larger;
|
||||||
|
height: 16px;
|
||||||
|
bottom: 60px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<h1 style="text-align: center; margin-bottom: 50px">Cart</h1>
|
<h1 style="text-align: center; margin-bottom: 50px">Cart</h1>
|
||||||
|
<div class="container">
|
||||||
<div>
|
@foreach (var product in Model.products) {
|
||||||
|
<div class="product-div">
|
||||||
|
<img class="product-img" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSe7MHcuWUvuNJsttl3MEVxEayUGVNH4tA2Ha0K4szpgKvH7QYuiaBa_hCzUgW96I6LXqM&usqp=CAU">
|
||||||
|
<label class="product-description">@Html.DisplayFor(modelproduct => product.Description)</label>
|
||||||
|
<div class="button-row">
|
||||||
|
<img class="star" src="~/assets/star.png">
|
||||||
|
<label class="rating">@Html.DisplayFor(modelproduct => product.Rating)</label>
|
||||||
|
@{
|
||||||
|
string price = "N/A";
|
||||||
|
if(!(product.Price is null)) {
|
||||||
|
price = "$" + product.Price.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<label class="price-label">@price</label>
|
||||||
|
</div>
|
||||||
|
<form class="button">
|
||||||
|
<button class="button-amazon">
|
||||||
|
<img src="~/assets/amazon.png">
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
@ -5,8 +5,21 @@ namespace ShoppingAssistantWebClient.Web.Pages
|
|||||||
{
|
{
|
||||||
public class CartModel : PageModel
|
public class CartModel : PageModel
|
||||||
{
|
{
|
||||||
|
public List<Product> products = new List<Product> {
|
||||||
|
new Product {Description = "HDMI cabel HDMI cabel HDMI cabel HDMI cabel HDMI cabel HDMI cabelHDMI cabel", Rating = 4.0, Price = 12},
|
||||||
|
new Product {Description = "super mega hdmi cabel", Rating = 3.8, Price = 13.11},
|
||||||
|
new Product {Description = "", Rating = 4.0}
|
||||||
|
};
|
||||||
|
|
||||||
public void OnGet()
|
public void OnGet()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Product {
|
||||||
|
public string Description {get; set;}
|
||||||
|
public double? Rating {get; set;}
|
||||||
|
public double? Price {get; set;}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
ShoppingAssistantWebClient.Web/wwwroot/assets/amazon.png
Normal file
BIN
ShoppingAssistantWebClient.Web/wwwroot/assets/amazon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
ShoppingAssistantWebClient.Web/wwwroot/assets/star.png
Normal file
BIN
ShoppingAssistantWebClient.Web/wwwroot/assets/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 375 B |
Loading…
Reference in New Issue
Block a user