101 lines
3.4 KiB
HTML
101 lines
3.4 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Modellauto - Startseite</title>
|
||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||
</head>
|
||
<body>
|
||
<div class="wrapper">
|
||
<!-- Header -->
|
||
<div id="header-placeholder"></div>
|
||
<script>
|
||
fetch(href="/header")
|
||
.then(response => response.text())
|
||
.then(data => {
|
||
document.getElementById('header-placeholder').innerHTML = data;
|
||
})
|
||
.catch(error => console.error('Fehler beim Laden des Headers:', error));
|
||
</script>
|
||
|
||
<!-- Infobereich -->
|
||
<section style="padding: 40px 20px; text-align: center; background: #fff;">
|
||
<h2>Willkommen beim Modellauto-Shop</h2>
|
||
<p>Bei uns finden Sie hochwertige Modellautos – ob Oldtimer, Sportwagen, Lkw's oder Motorräder.
|
||
Perfekt für Sammler, Bastler und Fans.
|
||
</p>
|
||
</section>
|
||
|
||
<!-- Hauptinhalt -->
|
||
<h1>Unsere Neusten Produkte: </h1>
|
||
<section class="card-grid" id="latest-products">
|
||
<!-- Dynamische Produkte (5 aktuelle Produkte) -->
|
||
</section>
|
||
|
||
<script>
|
||
fetch('/api/products/new')
|
||
.then(res => res.json())
|
||
.then(products => {
|
||
const container = document.getElementById('latest-products');
|
||
container.innerHTML = ''; // sicherheitshalber leeren
|
||
|
||
products.forEach(product => {
|
||
const card = document.createElement('div');
|
||
card.classList.add('card');
|
||
card.innerHTML = `
|
||
<img src="${product.image_url}" alt="${product.name}">
|
||
<h3>${product.name}</h3>
|
||
<p>Preis: ${product.price}€</p>
|
||
<p>${product.description}</p>
|
||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||
`;
|
||
container.appendChild(card);
|
||
});
|
||
})
|
||
.catch(err => {
|
||
console.error('Fehler beim Laden der neuesten Produkte:', err);
|
||
});
|
||
</script>
|
||
|
||
|
||
<!-- Info-Sektion -->
|
||
<section class="info-cards-section">
|
||
<div class="info-card">
|
||
<i class='bx bx-package'></i>
|
||
<h3>Versandkostenfrei ab 50 €</h3>
|
||
<p>Schneller & sicherer Versand mit Sendungsverfolgung.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-credit-card'></i>
|
||
<h3>Flexible Zahlungsmethoden</h3>
|
||
<p>PayPal, Kreditkarte, Klarna, Vorkasse – Sie haben die Wahl.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-undo'></i>
|
||
<h3>14 Tage Rückgaberecht</h3>
|
||
<p>Unzufrieden? Kein Problem – Rückgabe einfach & unkompliziert.</p>
|
||
</div>
|
||
<div class="info-card">
|
||
<i class='bx bx-star'></i>
|
||
<h3>Top-Bewertungen</h3>
|
||
<p>Unsere Kunden lieben uns – überzeugen Sie sich selbst!</p>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- Fußzeiele -->
|
||
<div id="footer"></div>
|
||
|
||
<script>
|
||
fetch('/footer')
|
||
.then(response => response.text())
|
||
.then(data => {
|
||
document.getElementById('footer').innerHTML = data;
|
||
});
|
||
</script>
|
||
|
||
</div>
|
||
</body>
|
||
</html>
|