upd
This commit is contained in:
27
index.html
27
index.html
@@ -127,6 +127,17 @@
|
||||
.product-item {
|
||||
padding: 0.25rem 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
object-fit: cover;
|
||||
border-radius: 4px;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.product-item:last-child {
|
||||
@@ -261,7 +272,21 @@
|
||||
products.slice(0, 3).forEach(p => {
|
||||
const li = document.createElement('li');
|
||||
li.className = 'product-item';
|
||||
li.textContent = `📦 ${p.cName}`;
|
||||
|
||||
// Image
|
||||
if (p.images && p.images.length > 0) {
|
||||
const img = document.createElement('img');
|
||||
img.className = 'product-image';
|
||||
img.src = `/img/prod/${p.images[0]}.avif`;
|
||||
img.alt = p.cName;
|
||||
img.onerror = () => img.style.display = 'none';
|
||||
li.appendChild(img);
|
||||
}
|
||||
|
||||
const span = document.createElement('span');
|
||||
span.textContent = p.cName;
|
||||
li.appendChild(span);
|
||||
|
||||
ul.appendChild(li);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user