forked from aakarshkumarsaksham/OverStock
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.html
More file actions
267 lines (247 loc) · 9.67 KB
/
page.html
File metadata and controls
267 lines (247 loc) · 9.67 KB
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script
src="https://kit.fontawesome.com/e9a5a74c45.js"
crossorigin="anonymous"
></script>
<link rel="stylesheet" href="./style/page.css" />
<link rel="stylesheet" href="./style/common.css" />
<title>Document</title>
</head>
<body>
<header>
<svg height="32" width="181" color="#FF1F2C" viewBox="0 0 164 29">
<g fill="none" fill-rule="evenodd">
<g fill="#000">
<path
d="M164 23.126h-.274v-1.96h-.01l-.764 1.96h-.178l-.763-1.96H162v1.96h-.275v-2.188h.506l.631 1.617h.01l.622-1.617H164v2.188zm-2.684-1.98h-.705v1.98h-.274v-1.98h-.705v-.208h1.684v.208zM34.58 14.78c0 3.558 1.94 7.117 5.855 7.117 3.914 0 5.855-3.559 5.855-7.118 0-3.558-1.94-7.117-5.855-7.117-3.915 0-5.856 3.559-5.856 7.117m13.75 0c0 4.788-2.783 8.833-7.894 8.833-5.112 0-7.894-4.045-7.894-8.833s2.782-8.831 7.894-8.831c5.111 0 7.894 4.043 7.894 8.831M47.965 6.433h2.264l5.241 14.655h.065l5.176-14.655h2.103L56.57 23.126h-2.167zM75.506 13.615C75.409 10.54 73.5 7.662 70.2 7.662c-3.332 0-5.176 2.912-5.5 5.953h10.806zM64.7 15.329c.032 2.977 1.585 6.568 5.5 6.568 2.977 0 4.594-1.747 5.24-4.27h2.04c-.874 3.785-3.074 5.984-7.28 5.984-5.306 0-7.538-4.076-7.538-8.832 0-4.4 2.232-8.831 7.538-8.831 5.37 0 7.506 4.69 7.344 9.381H64.7zM98.486 11.318c-.097-2.524-2.038-3.656-4.367-3.656-1.812 0-3.947.712-3.947 2.88 0 1.811 2.07 2.458 3.462 2.814l2.717.615c2.33.355 4.756 1.714 4.756 4.626 0 3.623-3.591 5.015-6.697 5.015-3.883 0-6.535-1.812-6.859-5.889h2.039c.162 2.75 2.2 4.174 4.917 4.174 1.91 0 4.562-.841 4.562-3.17 0-1.941-1.812-2.589-3.656-3.042l-2.62-.582c-2.653-.712-4.66-1.618-4.66-4.465 0-3.397 3.333-4.69 6.277-4.69 3.332 0 5.985 1.747 6.114 5.37h-2.038zM106.109 6.433h3.397v1.714h-3.397v11.259c0 1.326.194 2.103 1.65 2.2.582 0 1.165-.033 1.747-.097v1.747c-.615 0-1.197.064-1.812.064-2.718 0-3.656-.905-3.623-3.752V8.148h-1.973V6.432h1.973V1.419h2.038v5.014zM111.924 14.78c0 3.558 1.941 7.117 5.856 7.117s5.856-3.559 5.856-7.118c0-3.558-1.941-7.117-5.856-7.117s-5.856 3.559-5.856 7.117m13.75 0c0 4.788-2.783 8.833-7.894 8.833-5.111 0-7.894-4.045-7.894-8.833s2.783-8.831 7.894-8.831c5.111 0 7.894 4.043 7.894 8.831M140.117 11.674c-.55-2.491-2.07-4.012-4.723-4.012-3.915 0-5.856 3.559-5.856 7.117 0 3.56 1.94 7.118 5.856 7.118 2.523 0 4.594-1.974 4.852-4.756h2.038c-.55 4.012-3.17 6.47-6.89 6.47-5.112 0-7.894-4.043-7.894-8.832 0-4.788 2.782-8.832 7.894-8.832 3.559 0 6.308 1.91 6.761 5.727h-2.038zM144.425.027h2.038v14.494l9.253-8.088h2.717l-7.117 6.179 7.603 10.514h-2.556l-6.6-9.09-3.3 2.75v6.34h-2.038zM87.083 6.28c-2.342.324-4.105 1.796-4.981 4.067h-.065V6.433H80.16v16.693H82.2V14.23c0-3.03 1.931-5.488 4.884-5.926V6.28z"
></path>
</g>
<g fill="#FF1F2C">
<path
d="M.666.06v14.66C2.828 8.896 8.816 4.443 14.9 4.443c6.74 0 11.04 5.464 9.609 12.202-1.105 5.195-5.295 9.628-10.243 11.388h14.374V.061H.666z"
></path>
<path
d="M20.04 16.645c0-5.824-3.463-10.547-7.734-10.547s-7.734 4.723-7.734 10.547c0 5.825 3.463 10.547 7.734 10.547s7.734-4.722 7.734-10.547"
></path>
</g>
</g>
</svg>
<div id="search">
<input type="text" placeholder="Search" />
<i class="fa-solid fa-magnifying-glass search-icon"></i>
</div>
<div id="user-account">
<i class="fa-regular fa-user user-icon"></i>
<p>Account</p>
<div id="tooltip">
<ul>
<li class="fullWidth">
<h2>
Sign In
<i class="fa-solid fa-chevron-right"></i>
</h2>
</li>
<li>View your account and check your order status.</li>
</ul>
<ul>
<li class="fullWidth">
<h2>
Create An Account
<i class="fa-solid fa-chevron-right"></i>
</h2>
</li>
<li>Track orders, save items to lists and more!</li>
</ul>
<ul>
<li>My Account</li>
<li>My Order</li>
<li>My Reviews</li>
<li>Help</li>
</ul>
</div>
</div>
<div id="user-list">
<i class="fa-regular fa-heart user-icon"></i>
<p>List</p>
<div id="tooltip">
<ul>
<li>Favourites</li>
<li>Save for Later</li>
</ul>
<ul>
<li>View All My Lists</li>
<li>Find My List</li>
</ul>
</div>
</div>
<div id="user-cart">
<i class="fa-solid fa-cart-shopping user-icon"></i>
<p>Cart</p>
</div>
</header>
<nav>
<ul>
<li>Furniture</li>
<li>Rugs</li>
<li>Decor</li>
<li>Bed & Bath</li>
<li>Home Improvement</li>
<li>Kitchen</li>
<li>Outdoor</li>
<li>Jewelry</li>
<li>Lighting</li>
<li>Kids & Baby</li>
<li>More</li>
</ul>
<div id="breakLine"></div>
<ul>
<li>Ideas</li>
<li class="crimson">Sales & Deals</li>
</ul>
</nav>
<!-- main content starts from here -->
<main>
<div id="product"></div>
</main>
<!-- main content ends here -->
<footer>
<div id="footlinks">
<ul>
<li><h2>MY ACCOUNT</h2></li>
<li>Orders & Returns</li>
<li>Email Preferences</li>
<li>Account Settings</li>
</ul>
<ul>
<li><h2>LET US HELP</h2></li>
<li>Customer Care</li>
<li>Shipping Information</li>
<li>Return Policy</li>
<li>International Help</li>
<li>Accessibility</li>
</ul>
<ul>
<li><h2>COMPANY INFORMATION</h2></li>
<li>About Overstock™</li>
<li>Contact Us</li>
<li>Careers</li>
<li>Investors Relations</li>
<li>Sell Your Products</li>
<li>Supply Chain Transparency</li>
</ul>
<ul>
<li><h2>MORE WAYS TO HELP</h2></li>
<li>Tips & Ideas</li>
<li>Deals</li>
<li>Clearance</li>
<li>New Arrivals</li>
</ul>
</div>
<div id="endCredits">
<div id="address">
<p>© Copyright 2022, Overstock.com®, Inc.</p>
<p>799 Coliseum Way Midvale, UT 84047 | 1-800-843-2446</p>
</div>
<div id="additionalLinks">
<ul>
<li>Privacy Policy</li>
<li>Terms & Conditions</li>
<li>*Promotion Terms</li>
<li>
Ship To:
<img
src="https://ak1.ostkcdn.com/img/mxc/intFlag_IN.gif"
alt=""
/>
</li>
</ul>
</div>
</div>
</footer>
</body>
</html>
<script>
var cartData = JSON.parse(localStorage.getItem("cartData")) || [];
var pageData = JSON.parse(localStorage.getItem("pageData"));
var product = document.querySelector("#product");
var img = document.createElement("img");
img.src = pageData.img;
img.style.border = "1px solid #dadcdf";
var div = document.createElement("div");
div.id = "prodInfo";
var prodName = document.createElement("p");
prodName.innerText = pageData.name;
var rating = document.createElement("span");
rating.className = "rating";
rating.innerText = pageData.rating;
rating.style.padding = "5px 10px";
rating.style.color = "white";
rating.style.backgroundColor = "green";
rating.style.width = "fit-content";
rating.style.borderRadius = "5px";
var price = document.createElement("p");
price.innerHTML = `Sale<sup style="font-size: 12px">INR</sup>${pageData.price}`;
price.style.color = "#ac1b25";
var div2 = document.createElement("div");
div2.id = "selectCart";
var select = document.createElement("select");
var opt1 = document.createElement("option");
opt1.value = "1";
opt1.innerText = "Quantitiy: 1";
var opt2 = document.createElement("option");
opt2.value = "2";
opt2.innerText = "Quantitiy: 2";
var opt3 = document.createElement("option");
opt3.value = "3";
opt3.innerText = "Quantitiy: 3";
var opt4 = document.createElement("option");
opt4.value = "4";
opt4.innerText = "Quantitiy: 4";
var opt5 = document.createElement("option");
opt5.value = "5";
opt5.innerText = "Quantitiy: 5";
select.append(opt1, opt2, opt3, opt4, opt5);
select.style.padding = "5px 10px";
select.style.width = "fit-content";
var btn = document.createElement("button");
btn.innerText = "Add to Cart";
btn.addEventListener("click", addToCart);
btn.style.width = "45%";
btn.style.padding = "5px 10px";
btn.style.backgroundColor = "green";
btn.style.color = "white";
btn.style.border = "none";
btn.style.borderRadius = "2px";
div2.append(select, btn);
div2.style.display = "flex";
div2.style.justifyContent = "space-between";
div2.style.width = "100%";
div.append(prodName, rating, price, div2);
div.style.display = "flex";
div.style.flexDirection = "column";
div.style.gap = "20px";
div.style.padding = "0 30px";
div.style.minWidth = "450px";
product.append(img, div);
// console.log(pageData)
function addToCart() {
var qty = document.querySelector("select").value;
var obj = {
img: pageData.img,
rating: pageData.rating,
name: pageData.name,
price: pageData.price,
qty: Number(qty),
};
cartData.push(obj);
console.log(cartData);
localStorage.setItem("cartData", JSON.stringify(cartData));
alert("Item added to cart");
}
</script>
<script src="./script/common.js"></script>