-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWishlist.razor
93 lines (77 loc) · 3.12 KB
/
Wishlist.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
@page "/wishlist"
@using EveryoneReads.Backend
@inject NavigationManager NavMan
<PageTitle>Wishlist | Everyone Reads</PageTitle>
<h3 style="color:white">Wishlist</h3>
<style>
body {
background: linear-gradient(320deg, rgba(155,234,255,1) 0%, rgba(101,61,255,1) 0%, rgba(162,139,255,1) 100%);
}
</style>
<div class="row row-cols-1 row-cols-sm-4 g-2">
@foreach (var book in Util.Wishlist)
{
<div class="col">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-10"><span class="d-inline-block text-truncate" style="max-width: 310px">@book.Title</span></div>
<div class="col">
<button class="btn btn-primary-outline" style="color:red" @onclick="(e => Util.Wishlist.Remove(book))">X</button>
</div>
</div>
</div>
<div class="card-body">
<div class="container" style="height:200px">
<div class="row">
<div class="col-6">
<img @onclick="@(e => NavigateTo(@book.GoogleBooksID))" src="@book.CoverURL" class="card-img-top img-fluid" alt="@book.Title's cover" style="height:80%;width:auto;object-fit:fill;cursor:pointer">
</div>
<div class="col">
<p class="text-sm-start">
Publisher: @book.Publisher
<br>
Authors: @string.Join(",",@book.Authors)
<br>
Published: @book.PublishDate
</p>
</div>
</div>
</div>
</div>
<div class="card-footer text-muted">
<div class="container">
<div class="row">
<div class="col">
<button class="btn btn-primary" style="width:100%;background:grey; color:#FFF;border-color:#FFF" @onclick="() => Util.MyBooks.Add(book)">Price: $@book.Price </button>
</div>
</div>
</div>
</div>
</div>
</div>
}
<br />
</div>
<div style="position:fixed;bottom:50px;right:400px;font-family:Roboto">
<span class="fs-1 text-white">Total: $@TotalPrice</span>
<button type="button" style="margin-left:50px;bottom:50px" class="fs-1 btn btn-success btn-lg rounded-3 fw-bold">Purchase</button>
</div>
@code {
private float TotalPrice
{
get
{
float tmp = 0;
foreach (var item in Util.Wishlist)
{
tmp += item.Price;
}
return tmp;
}
}
private async Task NavigateTo(string googleBooksID)
{
NavMan.NavigateTo(NavMan.BaseUri + "book?google=" + googleBooksID);
}
}