-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
206 lines (177 loc) · 4.53 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>ReVestis - Clothing Store</title>
<link href="https://fonts.googleapis.com/css2?family=Outfit&display=swap" rel="stylesheet">
<style>
/* Global styles */
body {
font-family: "Outfit", sans-serif;
margin: 0;
padding: 0;
}
/* Header styles */
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 2%;
background-color: #f5f5f5;
}
.logo img {
width: 30%;
height: auto;
}
.points {
display: flex;
align-items: center;
gap: 10px;
font-weight: bold;
font-size: 1.6rem;
}
.points img {
width: 15%;
height: auto;
}
/* Main styles */
main {
padding: 4%;
}
.clothes-wrapper {
text-align: center; /* Added */
}
.clothes {
display: flex;
justify-content: center;
gap: 4%;
width: 100%;
}
.item {
flex: .5 .5 5%; /* Increase scale of divs */
border: 1px solid #e5e5e5;
padding: 4%;
text-align: center;
border-radius: 10px;
}
.item img {
max-width: 100%;
height: auto;
margin-bottom: 4%;
}
.item h2 {
font-size: 1.8rem;
margin-bottom: 2%;
}
.item p {
font-size: 1.4rem;
color: #888888;
margin-bottom: 3%;
}
.buy-button {
padding: 3.5% 5%; /* Decrease scale of buy button */
background-color: #4caf50;
color: white;
border: none;
cursor: pointer;
border-radius: 5px;
}
.buy-button:hover {
background-color: #58c85e;
}
.notification {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background-color: #4caf50;
color: white;
padding: 10px 20px;
border-radius: 5px;
z-index: 9999;
opacity: 1;
transition: opacity 0.3s ease-in-out;
}
.notification.hide {
opacity: 0;
}
</style>
</head>
<body>
<header>
<div class="logo">
<img src="ReVestis.png" alt="ReVestis Logo">
</div>
<div class="points">
<img src="points.png" alt="Points Icon">
<span>500 Points</span>
</div>
</header>
<main>
<div class="clothes-wrapper">
<div class="clothes">
<div class="item">
<img src="Cloth1.png" alt="Cloth 1">
<h2>Cloth 1</h2>
<p>Points needed: 100</p>
<button class="buy-button">Buy</button>
</div>
<div class="item">
<img src="Cloth2.png" alt="Cloth 2">
<h2>Cloth 2</h2>
<p>Points needed: 100</p>
<button class="buy-button">Buy</button>
</div>
<div class="item">
<img src="Cloth3.png" alt="Cloth 3">
<h2>Cloth 3</h2>
<p>Points needed: 100</p>
<button class="buy-button">Buy</button>
</div>
</div>
</div>
</main>
<script>
// Get references to elements
const pointsElement = document.querySelector('.points span');
const buyButtons = document.querySelectorAll('.buy-button');
let points = 500; // Initial points value
// Update the points display
function updatePointsDisplay() {
pointsElement.textContent = points + ' Points';
}
// Deduct points and update the display
function deductPoints() {
points -= 100;
updatePointsDisplay();
}
// Show notification
function showNotification(message) {
const notification = document.createElement('div');
notification.textContent = message;
notification.classList.add('notification');
document.body.appendChild(notification);
setTimeout(() => {
notification.classList.add('hide');
setTimeout(() => {
notification.remove();
}, 300);
}, 3000);
}
// Handle buy button click
function handleBuyButtonClick() {
if (points >= 100) {
deductPoints();
showNotification('Purchased');
} else {
showNotification('Insufficient points. Earn more points to make a purchase.');
}
}
// Attach event listeners to buy buttons
buyButtons.forEach(button => {
button.addEventListener('click', handleBuyButtonClick);
});
// Initial points display
updatePointsDisplay();
</script>
</body>
</html>