-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduct.html
More file actions
151 lines (136 loc) · 4.49 KB
/
product.html
File metadata and controls
151 lines (136 loc) · 4.49 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>God's Firm Company Ltd</title>
<link rel="icon" type="image/png" href="Images/God.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
</head>
<style>
/* ===== GLOBAL FULL HEIGHT FIX ===== */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
font-family: "Source Sans Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
background: #f5f7fa;
color: #222;
}
/* Main fills remaining space */
main {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
padding-top: 2rem;
padding-bottom: 3rem;
min-height: calc(100vh - 160px); /* ensures footer never floats */
}
/* ===== FOOTER ===== */
footer {
flex-shrink: 0;
background: #111;
color: #f5f5f5;
padding: 1.5rem 0;
text-align: center;
width: 100%;
margin-top: auto;
}
footer a {
color: #ffc107;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
/* ===== PRODUCT IMAGE ===== */
.img-fluid {
max-height: 500px;
object-fit: cover;
}
/* ===== BUTTONS ===== */
.btn {
transition: transform 0.2s ease;
}
.btn:hover {
transform: scale(1.05);
}
/* ===== MOBILE ===== */
@media (max-width: 768px) {
main { padding: 2rem 1rem; }
}
@media (max-width: 480px) {
#qty { width: 60px !important; }
}
</style>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary sticky-top">
<div class="container">
<a class="navbar-brand d-flex align-items-center" href="index.html">
<img src="Images/firm.png" alt="Afeo" height="44" class="me-2">
</a>
<button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#nav"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="nav">
<ul class="navbar-nav ms-auto align-items-lg-center">
<li class="nav-item"><a class="nav-link" href="index.html">Home</a></li>
<li class="nav-item"><a class="nav-link" href="shop.html">Shop</a></li>
<li class="nav-item"><a class="nav-link" href="upload.html">Upload Project</a></li>
<li class="nav-item"><a class="nav-link" href="cart.html"><i class="fa fa-shopping-cart"></i> Cart <span id="cart-count" class="badge bg-warning text-dark ms-1">0</span></a></li>
</ul>
</div>
</div>
</nav>
<main class="py-5">
<div class="container" id="product-container"></div>
</main>
<footer class="bg-dark text-light py-4 text-center small">
© <span id="year3"></span> Afeo Roofing & Building Materials
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="app.js"></script>
<script>
document.getElementById('year3').innerText = new Date().getFullYear();
App.init();
const params = new URLSearchParams(location.search);
const id = params.get('id');
const p = App.getProductById(id);
const container = document.getElementById('product-container');
if(!p){
container.innerHTML = '<div class="alert alert-danger">Product not found.</div>';
} else {
container.innerHTML = `
<div class="row g-4">
<div class="col-md-6">
<img src="${p.image}" alt="${p.title}" class="img-fluid rounded">
</div>
<div class="col-md-6">
<h2>${p.title}</h2>
<p class="text-muted">${p.short}</p>
<h3 class="text-primary">${App.formatCurrency(p.price)}</h3>
<p>${p.description}</p>
<div class="d-flex gap-2 align-items-center mt-3">
<input id="qty" type="number" min="1" value="1" class="form-control w-25">
<button class="btn btn-warning" id="addBtn"><i class="fa fa-cart-plus"></i> Add to Cart</button>
<a href="cart.html" class="btn btn-outline-secondary">View Cart</a>
</div>
</div>
</div>
`;
document.getElementById('addBtn').addEventListener('click', () => {
const q = parseInt(document.getElementById('qty').value) || 1;
App.addToCart(p.id, q);
alert('Added to cart');
});
}
</script>
</body>
</html>