78 lines
3.0 KiB
PHP
78 lines
3.0 KiB
PHP
<?php
|
|
require_once 'config.php';
|
|
|
|
$jsonFile = 'assets/data.json';
|
|
$wishes = [];
|
|
if (file_exists($jsonFile)) {
|
|
$jsonData = file_get_contents($jsonFile);
|
|
$wishes = json_decode($jsonData, true);
|
|
if (!$wishes)
|
|
$wishes = [];
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="de">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Wunschliste von <?= htmlspecialchars($page_name) ?></title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<style>
|
|
:root {
|
|
--bg: <?= $color_bg_light ?>;
|
|
--fg: <?= $color_fg_light ?>;
|
|
--accent: <?= $color_accent_light ?>;
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
:root {
|
|
--bg: <?= $color_bg_dark ?>;
|
|
--fg: <?= $color_fg_dark ?>;
|
|
--accent: <?= $color_accent_dark ?>;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="min-h-screen bg-[var(--bg)] text-[var(--fg)] transition-colors">
|
|
<div class="max-w-2xl mx-auto px-4 py-10">
|
|
<h1 class="text-3xl sm:text-4xl font-bold text-center mb-8">
|
|
Wunschliste von <?= htmlspecialchars($page_name) ?> 🎁
|
|
</h1>
|
|
|
|
<div class="space-y-3">
|
|
<?php foreach ($wishes as $row):
|
|
$id = $row["id"] ?? uniqid();
|
|
$name = $row["name"] ?? '';
|
|
$link = $row["link"] ?? '';
|
|
$price = $row["price"] ?? '';
|
|
?>
|
|
<details class="group bg-[var(--bg)] border border-[var(--fg)]/10 rounded-xl shadow-sm overflow-hidden">
|
|
<summary class="flex items-center justify-between gap-3 px-5 py-4 cursor-pointer select-none font-medium hover:opacity-80 transition-opacity list-none">
|
|
<span><?= htmlspecialchars($name) ?></span>
|
|
<svg class="w-5 h-5 shrink-0 transition-transform duration-200 group-open:rotate-180"
|
|
fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
|
|
</svg>
|
|
</summary>
|
|
<div class="px-5 pb-4 pt-1 border-t border-[var(--fg)]/10 flex items-center justify-between flex-wrap gap-2">
|
|
<a href="<?= htmlspecialchars($link) ?>" target="_blank" rel="noopener"
|
|
class="text-[var(--accent)] hover:underline font-medium">
|
|
Zum Produkt ↗
|
|
</a>
|
|
<span class="text-sm font-semibold opacity-70 border border-[var(--fg)]/20 px-3 py-1 rounded-full">
|
|
<?= htmlspecialchars($price) ?>
|
|
</span>
|
|
</div>
|
|
</details>
|
|
<?php endforeach; ?>
|
|
|
|
<?php if (empty($wishes)): ?>
|
|
<p class="text-center opacity-50 py-10">Noch keine Wünsche eingetragen.</p>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|