1.1.0
This commit is contained in:
@@ -1,69 +1,78 @@
|
||||
<?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 <?php include 'config.php'; echo $page_name; ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
margin: 100px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
||||
body {
|
||||
background-color: #1a1a1a;
|
||||
color: #f0f0f0;
|
||||
<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 ?>;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: #8ab4f8;
|
||||
}
|
||||
}
|
||||
@media (max-whidth: 600px) {
|
||||
body {
|
||||
margin: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body">
|
||||
<h1 style="margin: 15px;">Wunschliste von <?php include 'config.php'; echo $page_name; ?> 🎁</h1>
|
||||
<div class="content">
|
||||
<?php
|
||||
$jsonFile = 'wishes.json';
|
||||
|
||||
$wishes = [];
|
||||
if (file_exists($jsonFile)) {
|
||||
$jsonData = file_get_contents($jsonFile);
|
||||
$wishes = json_decode($jsonData, true);
|
||||
if (!$wishes) $wishes = [];
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: <?= $color_bg_dark ?>;
|
||||
--fg: <?= $color_fg_dark ?>;
|
||||
--accent: <?= $color_accent_dark ?>;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
foreach ($wishes as $row) {
|
||||
$id = $row["id"] ?? uniqid();
|
||||
$name = $row["name"] ?? '';
|
||||
$link = $row["link"] ?? '';
|
||||
$price = $row["price"] ?? '';
|
||||
<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>
|
||||
|
||||
echo '<div class="accordion accordion-flush" id="accordionFlushExample">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-' . $id . '" aria-expanded="false" aria-controls="flush-collapseOne">
|
||||
' . htmlspecialchars($name) . '
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse-' . $id . '" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
|
||||
<div class="accordion-body"><a href="' . htmlspecialchars($link) . '" target="_blank">Zum Produkt</a>, ' . htmlspecialchars($price) . '</div>
|
||||
<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>
|
||||
</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user