Rubriken: Ober- und Unterkategorien, eigene Rubrik-Seiten mit Titelbild und Unterkategorien, Aufklappmenü in der Navigation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvuGvHpbAQ4syfuLuRvutL
This commit is contained in:
parent
451160ab71
commit
e376fa8877
22 changed files with 321 additions and 78 deletions
|
|
@ -0,0 +1,6 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "Category" ADD COLUMN "parentId" TEXT;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Category" ADD CONSTRAINT "Category_parentId_fkey" FOREIGN KEY ("parentId") REFERENCES "Category"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
|
|
@ -87,17 +87,21 @@ model Address {
|
|||
// ---------- Katalog ----------
|
||||
|
||||
model Category {
|
||||
id String @id @default(cuid())
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
slug String @unique
|
||||
description String @default("")
|
||||
image String @default("")
|
||||
sort Int @default(0)
|
||||
active Boolean @default(true)
|
||||
showOnHome Boolean @default(true)
|
||||
slug String @unique
|
||||
description String @default("")
|
||||
image String @default("")
|
||||
sort Int @default(0)
|
||||
active Boolean @default(true)
|
||||
showOnHome Boolean @default(true)
|
||||
// Oberkategorie; leer = selbst Oberkategorie. Höchstens zwei Ebenen.
|
||||
parentId String?
|
||||
parent Category? @relation("CategoryTree", fields: [parentId], references: [id], onDelete: SetNull)
|
||||
children Category[] @relation("CategoryTree")
|
||||
products Product[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Product {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||
return { title: c?.name ?? "Kategorie" };
|
||||
}
|
||||
|
||||
const activeChildren = { where: { active: true }, orderBy: [{ sort: "asc" as const }, { name: "asc" as const }] };
|
||||
|
||||
export default async function CategoryPage({
|
||||
params,
|
||||
searchParams,
|
||||
|
|
@ -17,20 +19,54 @@ export default async function CategoryPage({
|
|||
searchParams: Promise<{ sort?: string }>;
|
||||
}) {
|
||||
const [{ slug }, { sort }] = await Promise.all([params, searchParams]);
|
||||
const category = await db.category.findUnique({ where: { slug } });
|
||||
if (!category || !category.active) notFound();
|
||||
const category = await db.category.findUnique({ where: { slug }, include: { children: activeChildren, parent: { include: { children: activeChildren } } } });
|
||||
if (!category || !category.active || (category.parent && !category.parent.active)) notFound();
|
||||
|
||||
// Eine Oberkategorie ist eine eigene Rubrik: Titelbild, Text und nur ihre Produkte samt Unterkategorien
|
||||
const rubric = category.parent ?? category;
|
||||
const subs = rubric.children;
|
||||
const chips = subs.length
|
||||
? [{ label: "Alle", href: `/kategorie/${rubric.slug}`, active: !category.parent }, ...subs.map((c) => ({ label: c.name, href: `/kategorie/${c.slug}`, active: c.id === category.id }))]
|
||||
: undefined;
|
||||
const ids = category.parent ? [category.id] : [category.id, ...subs.map((c) => c.id)];
|
||||
const crumbs = (
|
||||
<nav aria-label="Du bist hier">
|
||||
<ol className="sm-crumbs">
|
||||
<li><Link href="/">Start</Link></li>
|
||||
{category.parent ? <li><Link href={`/kategorie/${category.parent.slug}`}>{category.parent.name}</Link></li> : <li><Link href="/shop">Shop</Link></li>}
|
||||
<li aria-current="page">{category.name}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
);
|
||||
|
||||
return (
|
||||
<main className="sm-container sm-page">
|
||||
<nav aria-label="Du bist hier">
|
||||
<ol className="sm-crumbs">
|
||||
<li><Link href="/">Start</Link></li>
|
||||
<li><Link href="/shop">Shop</Link></li>
|
||||
<li aria-current="page">{category.name}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<h1 className="display-lg sm-page__title" style={{ marginTop: "var(--space-5)" }}>{category.name}</h1>
|
||||
{category.description && <p className="body sm-page__lead">{category.description}</p>}
|
||||
<ProductList basePath={`/kategorie/${slug}`} where={{ categoryId: category.id }} sort={sort} showCategoryChips activeCategory={slug} />
|
||||
</main>
|
||||
<>
|
||||
{!category.parent && category.image ? (
|
||||
<section className="sm-hero sm-rubric-hero" data-theme="dark">
|
||||
<div className="sm-container sm-hero__inner">
|
||||
<div>
|
||||
{crumbs}
|
||||
<h1 className="sm-hero__title display-xl" style={{ marginTop: "var(--space-5)" }}>{category.name}</h1>
|
||||
<div className="sm-hero__rule" aria-hidden="true" />
|
||||
{category.description && <p className="sm-hero__text">{category.description}</p>}
|
||||
</div>
|
||||
<div className="sm-hero__media">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={category.image} alt="" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
<main className="sm-container sm-page">
|
||||
{(category.parent || !category.image) && (
|
||||
<>
|
||||
{crumbs}
|
||||
<h1 className="display-lg sm-page__title" style={{ marginTop: "var(--space-5)" }}>{category.name}</h1>
|
||||
{category.description && <p className="body sm-page__lead">{category.description}</p>}
|
||||
</>
|
||||
)}
|
||||
<ProductList basePath={`/kategorie/${slug}`} where={{ categoryId: { in: ids } }} sort={sort} chips={chips} />
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { ProductImage } from "@/components/shop/ProductImage";
|
|||
export const metadata = { title: "Kollektionen" };
|
||||
|
||||
export default async function CollectionsPage() {
|
||||
const categories = await db.category.findMany({ where: { active: true }, orderBy: { sort: "asc" } });
|
||||
const categories = await db.category.findMany({ where: { active: true, parentId: null }, orderBy: { sort: "asc" } });
|
||||
return (
|
||||
<main className="sm-container sm-page">
|
||||
<span className="eyebrow">Kollektionen</span>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { requireAdmin } from "@/lib/auth";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { getCategoryTree } from "@/lib/categories";
|
||||
import { Field, TextareaField } from "@/components/Field";
|
||||
import { AdminForm } from "@/components/admin/AdminForm";
|
||||
import { NavEditor, TrustEditor } from "@/components/admin/ListEditors";
|
||||
|
|
@ -8,7 +9,9 @@ import { saveAppearance } from "./actions";
|
|||
|
||||
export default async function AppearancePage() {
|
||||
await requireAdmin("appearance.edit");
|
||||
const a = (await getSettings()).appearance;
|
||||
const [settings, tree] = await Promise.all([getSettings(), getCategoryTree(true)]);
|
||||
const a = settings.appearance;
|
||||
const rubrics = tree.map((r) => ({ name: r.name, slug: r.slug }));
|
||||
return (
|
||||
<div className="ad-wrap ad-wrap--narrow">
|
||||
<PageHead title="Startseite & Texte" lead="Alles, was Besucher auf der Startseite, im Kopf und im Fuß des Shops sehen.">
|
||||
|
|
@ -22,8 +25,8 @@ export default async function AppearancePage() {
|
|||
<Field label="Link-Ziel" optional name="promoLinkHref" defaultValue={a.promoLinkHref} />
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="Hauptmenü" lead="Die Punkte in der Kopfzeile, in dieser Reihenfolge.">
|
||||
<NavEditor name="navigation" initial={a.navigation} />
|
||||
<Card title="Hauptmenü" lead="Die Punkte in der Kopfzeile, in dieser Reihenfolge. Wählst du eine Rubrik (Oberkategorie), wird sie zu einem eigenen Shop-Bereich, und ihre Unterkategorien klappen beim Darüberfahren als Menü auf.">
|
||||
<NavEditor name="navigation" initial={a.navigation} rubrics={rubrics} />
|
||||
<Switch name="darkHeader" label="Dunkle Kopfzeile" hint="Schwarz mit goldenem Logo statt hell." defaultChecked={a.darkHeader} />
|
||||
</Card>
|
||||
<Card title="Großer Einstieg (Hero)" lead="Der dunkle Bereich mit dem Logo ganz oben auf der Startseite.">
|
||||
|
|
|
|||
|
|
@ -17,7 +17,16 @@ export async function saveCategory(_prev: ActionResult, fd: FormData): Promise<A
|
|||
try {
|
||||
image = (JSON.parse(String(fd.get("image") ?? "[]")) as string[])[0] ?? "";
|
||||
} catch {}
|
||||
// Höchstens zwei Ebenen: Oberkategorie muss selbst oben stehen, eine Oberkategorie mit Kindern bleibt oben
|
||||
let parentId = String(fd.get("parentId") ?? "") || null;
|
||||
if (parentId) {
|
||||
const parent = await db.category.findUnique({ where: { id: parentId } });
|
||||
if (!parent || parent.id === id) parentId = null;
|
||||
else if (parent.parentId) return fail("Unterkategorien können keine eigenen Unterkategorien haben. Wähle eine Oberkategorie.", { parentId: "Nur Oberkategorien" });
|
||||
if (id && parentId && (await db.category.count({ where: { parentId: id } }))) return fail("Diese Kategorie hat selbst Unterkategorien und kann deshalb nicht untergeordnet werden.", { parentId: "Hat Unterkategorien" });
|
||||
}
|
||||
const data = {
|
||||
parentId: fd.has("parentId") ? parentId : undefined,
|
||||
name,
|
||||
slug,
|
||||
description: String(fd.get("description") ?? ""),
|
||||
|
|
|
|||
|
|
@ -1,14 +1,15 @@
|
|||
import { db } from "@/lib/db";
|
||||
import { requireAdmin } from "@/lib/auth";
|
||||
import { Field, TextareaField } from "@/components/Field";
|
||||
import { Field, SelectField, TextareaField } from "@/components/Field";
|
||||
import { AdminForm, ConfirmButton } from "@/components/admin/AdminForm";
|
||||
import { ImageManager } from "@/components/admin/ImageManager";
|
||||
import { PageHead } from "@/components/admin/ui";
|
||||
import { deleteCategory, saveCategory } from "./actions";
|
||||
|
||||
type C = { id?: string; name: string; slug: string; description: string; image: string; sort: number; active: boolean; showOnHome: boolean };
|
||||
type C = { id?: string; name: string; slug: string; description: string; image: string; sort: number; active: boolean; showOnHome: boolean; parentId: string | null };
|
||||
type Parent = { id: string; name: string };
|
||||
|
||||
function CategoryFields({ c }: { c: C }) {
|
||||
function CategoryFields({ c, parents, hasChildren }: { c: C; parents: Parent[]; hasChildren?: boolean }) {
|
||||
return (
|
||||
<div className="ad-grid ad-grid--2-1">
|
||||
<div>
|
||||
|
|
@ -17,6 +18,14 @@ function CategoryFields({ c }: { c: C }) {
|
|||
<Field label="Name" name="name" defaultValue={c.name} required />
|
||||
<Field label="Web-Adresse" name="slug" defaultValue={c.slug} hint="Leer lassen für automatisch." />
|
||||
</div>
|
||||
{hasChildren ? (
|
||||
<p className="ad-help" style={{ margin: "var(--space-3) 0" }}>Oberkategorie mit Unterkategorien. Sie kann selbst keiner anderen Kategorie untergeordnet werden.</p>
|
||||
) : (
|
||||
<SelectField label="Gehört zu" name="parentId" defaultValue={c.parentId ?? ""} hint="Wähle eine Oberkategorie, dann wird diese Kategorie zur Unterkategorie.">
|
||||
<option value="">Keine, ist selbst Oberkategorie</option>
|
||||
{parents.filter((p) => p.id !== c.id).map((p) => <option key={p.id} value={p.id}>{p.name}</option>)}
|
||||
</SelectField>
|
||||
)}
|
||||
<TextareaField label="Beschreibung" optional name="description" defaultValue={c.description} rows={2} />
|
||||
<Field label="Reihenfolge" name="sort" type="number" defaultValue={c.sort} hint="Kleinere Zahl steht weiter vorne." />
|
||||
<label className="ad-switch"><span className="ad-switch__text"><strong>Im Shop sichtbar</strong></span><input type="checkbox" role="switch" name="active" defaultChecked={c.active} /></label>
|
||||
|
|
@ -24,7 +33,7 @@ function CategoryFields({ c }: { c: C }) {
|
|||
</div>
|
||||
<div>
|
||||
<span className="sm-field__label">Kachelbild</span>
|
||||
<ImageManager name="image" initial={c.image ? [c.image] : []} multiple={false} hint="Format 3:4 im Hochformat, ideal 1500 × 2000 px. Andere Formate werden mittig zugeschnitten. Das Motiv möglichst groß und mittig zeigen, eher Nahaufnahme als ganze Raumszene. Im unteren Fünftel liegt das Feld mit dem Namen." />
|
||||
<ImageManager name="image" initial={c.image ? [c.image] : []} multiple={false} hint="Format 3:4 im Hochformat, ideal 1500 × 2000 px. Andere Formate werden mittig zugeschnitten. Das Motiv möglichst groß und mittig zeigen, eher Nahaufnahme als ganze Raumszene. Im unteren Fünftel liegt das Feld mit dem Namen. Bei einer Oberkategorie ist es auch das Titelbild ihrer Rubrik-Seite (dort im Querformat zugeschnitten)." />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -32,28 +41,46 @@ function CategoryFields({ c }: { c: C }) {
|
|||
|
||||
export default async function CategoriesPage() {
|
||||
await requireAdmin("categories.edit");
|
||||
const categories = await db.category.findMany({ orderBy: { sort: "asc" }, include: { _count: { select: { products: true } } } });
|
||||
const categories = await db.category.findMany({ orderBy: [{ sort: "asc" }, { name: "asc" }], include: { _count: { select: { products: true } } } });
|
||||
const roots = categories.filter((c) => !c.parentId || !categories.some((p) => p.id === c.parentId));
|
||||
const childrenOf = (id: string) => categories.filter((c) => c.parentId === id);
|
||||
const parents = roots.map((r) => ({ id: r.id, name: r.name }));
|
||||
const card = (c: (typeof categories)[number], sub = false) => {
|
||||
const kids = childrenOf(c.id);
|
||||
const total = c._count.products + kids.reduce((n, k) => n + k._count.products, 0);
|
||||
return (
|
||||
<details className={`ad-card${sub ? " ad-cat--sub" : ""}`} key={c.id} style={{ marginBottom: "var(--space-3)" }}>
|
||||
<summary className="ad-card__head" style={{ cursor: "pointer", listStyle: "none" }}>
|
||||
<div>
|
||||
<h2>{sub && <span className="ad-muted" aria-hidden="true">↳ </span>}{c.name}</h2>
|
||||
<p>
|
||||
{kids.length ? `${total} Produkte, davon ${c._count.products} direkt · ${kids.length} Unterkategorie${kids.length === 1 ? "" : "n"}` : `${c._count.products} Produkte`} · /{c.slug}{c.active ? "" : " · versteckt"}
|
||||
</p>
|
||||
</div>
|
||||
<span className="body-sm" style={{ color: "var(--link)" }}>Bearbeiten</span>
|
||||
</summary>
|
||||
<div className="ad-card__body">
|
||||
<AdminForm action={saveCategory} extraActions={<ConfirmButton inForm action={deleteCategory} confirm={kids.length ? "Kategorie löschen? Ihre Unterkategorien werden zu Oberkategorien, die Produkte bleiben erhalten." : "Kategorie löschen? Die Produkte bleiben erhalten."}>Löschen</ConfirmButton>}>
|
||||
<CategoryFields c={c} parents={parents} hasChildren={kids.length > 0} />
|
||||
</AdminForm>
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
};
|
||||
return (
|
||||
<div className="ad-wrap">
|
||||
<PageHead title="Kategorien" lead="Kategorien gliedern den Shop und erscheinen als Kacheln auf der Startseite." />
|
||||
{categories.map((c) => (
|
||||
<details className="ad-card" key={c.id} style={{ marginBottom: "var(--space-3)" }}>
|
||||
<summary className="ad-card__head" style={{ cursor: "pointer", listStyle: "none" }}>
|
||||
<div><h2>{c.name}</h2><p>{c._count.products} Produkte · /{c.slug}{c.active ? "" : " · versteckt"}</p></div>
|
||||
<span className="body-sm" style={{ color: "var(--link)" }}>Bearbeiten</span>
|
||||
</summary>
|
||||
<div className="ad-card__body">
|
||||
<AdminForm action={saveCategory} extraActions={<ConfirmButton inForm action={deleteCategory} confirm="Kategorie löschen? Die Produkte bleiben erhalten.">Löschen</ConfirmButton>}>
|
||||
<CategoryFields c={c} />
|
||||
</AdminForm>
|
||||
</div>
|
||||
</details>
|
||||
<PageHead title="Kategorien" lead="Ober- und Unterkategorien gliedern den Shop. Eine Oberkategorie zeigt im Shop auch die Produkte ihrer Unterkategorien, ein Sale auf sie gilt ebenfalls für alle Unterkategorien." />
|
||||
{roots.map((r) => (
|
||||
<div key={r.id}>
|
||||
{card(r)}
|
||||
{childrenOf(r.id).map((k) => card(k, true))}
|
||||
</div>
|
||||
))}
|
||||
<section className="ad-card" style={{ marginTop: "var(--space-6)" }}>
|
||||
<div className="ad-card__head"><h2>Neue Kategorie</h2></div>
|
||||
<div className="ad-card__body">
|
||||
<AdminForm action={saveCategory} submitLabel="Kategorie anlegen">
|
||||
<CategoryFields c={{ name: "", slug: "", description: "", image: "", sort: categories.length, active: true, showOnHome: true }} />
|
||||
<CategoryFields c={{ name: "", slug: "", description: "", image: "", sort: categories.length, active: true, showOnHome: true, parentId: null }} parents={parents} />
|
||||
</AdminForm>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { notFound } from "next/navigation";
|
||||
import { db } from "@/lib/db";
|
||||
import { sortedForSelect } from "@/lib/categories";
|
||||
import { can, requireAdmin } from "@/lib/auth";
|
||||
import { centsToInput, formatPrice } from "@/lib/money";
|
||||
import { bestSale, getRunningSales, reduce } from "@/lib/sales";
|
||||
|
|
@ -46,7 +47,7 @@ export default async function EditProduct({ params, searchParams }: { params: Pr
|
|||
)}
|
||||
<ProductForm
|
||||
canStock={can(user, "stock.edit")}
|
||||
categories={categories}
|
||||
categories={sortedForSelect(categories)}
|
||||
values={{
|
||||
id: p.id,
|
||||
name: p.name,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { db } from "@/lib/db";
|
||||
import { sortedForSelect } from "@/lib/categories";
|
||||
import { can, requireAdmin } from "@/lib/auth";
|
||||
import { PageHead } from "@/components/admin/ui";
|
||||
import { ProductForm } from "@/components/admin/ProductForm";
|
||||
|
|
@ -11,7 +12,7 @@ export default async function NewProduct() {
|
|||
<PageHead title="Neues Produkt" back={{ href: "/admin/produkte", label: "Produkte" }} />
|
||||
<ProductForm
|
||||
canStock={can(user, "stock.edit")}
|
||||
categories={categories}
|
||||
categories={sortedForSelect(categories)}
|
||||
values={{ name: "", slug: "", subtitle: "", description: "", details: "", sku: "", weight: "", price: "", compareAtPrice: "", taxRate: 19, stock: 0, trackStock: true, active: true, featured: false, badge: "", categoryId: "", images: [], variants: [] }}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import Link from "next/link";
|
||||
import type { Prisma } from "@prisma/client";
|
||||
import { db } from "@/lib/db";
|
||||
import { categoryLabels, sortedForSelect, withSubcategories } from "@/lib/categories";
|
||||
import { can, requireAdmin } from "@/lib/auth";
|
||||
import { formatPrice } from "@/lib/money";
|
||||
import { Icon } from "@/components/Icon";
|
||||
|
|
@ -14,7 +15,8 @@ export default async function ProductsPage({ searchParams }: { searchParams: Pro
|
|||
const q = (sp.q ?? "").trim();
|
||||
const where: Prisma.ProductWhereInput = {
|
||||
...(q ? { OR: [{ name: { contains: q, mode: "insensitive" } }, { sku: { contains: q, mode: "insensitive" } }] } : {}),
|
||||
...(sp.kategorie ? { categoryId: sp.kategorie } : {}),
|
||||
// Oberkategorie zeigt auch die Produkte ihrer Unterkategorien
|
||||
...(sp.kategorie ? { categoryId: { in: await withSubcategories(sp.kategorie) } } : {}),
|
||||
...(sp.filter === "versteckt" ? { active: false } : sp.filter === "aktiv" ? { active: true } : {}),
|
||||
};
|
||||
const [products, categories] = await Promise.all([
|
||||
|
|
@ -22,6 +24,7 @@ export default async function ProductsPage({ searchParams }: { searchParams: Pro
|
|||
db.category.findMany({ orderBy: { sort: "asc" } }),
|
||||
]);
|
||||
const editable = can(user, "products.edit");
|
||||
const labels = categoryLabels(categories);
|
||||
return (
|
||||
<div className="ad-wrap">
|
||||
<PageHead title="Produkte" lead={`${products.length} Produkte`}>
|
||||
|
|
@ -32,7 +35,7 @@ export default async function ProductsPage({ searchParams }: { searchParams: Pro
|
|||
<input className="sm-input" type="search" name="q" defaultValue={q} placeholder="Name oder Art.-Nr. suchen" aria-label="Produkte suchen" />
|
||||
<span className="sm-select-wrap"><select className="sm-select" name="kategorie" defaultValue={sp.kategorie ?? ""} style={{ minHeight: "var(--control-height-sm)" }} aria-label="Kategorie">
|
||||
<option value="">Alle Kategorien</option>
|
||||
{categories.map((c) => <option key={c.id} value={c.id}>{c.name}</option>)}
|
||||
{sortedForSelect(categories).map((c) => <option key={c.id} value={c.id}>{c.label}</option>)}
|
||||
</select></span>
|
||||
<span className="sm-select-wrap"><select className="sm-select" name="filter" defaultValue={sp.filter ?? ""} style={{ minHeight: "var(--control-height-sm)" }} aria-label="Sichtbarkeit">
|
||||
<option value="">Alle</option><option value="aktiv">Sichtbar</option><option value="versteckt">Versteckt</option>
|
||||
|
|
@ -54,7 +57,7 @@ export default async function ProductsPage({ searchParams }: { searchParams: Pro
|
|||
<tr key={p.id}>
|
||||
<td style={{ width: 60 }}>{p.images[0] ? <img className="ad-thumb" src={p.images[0]} alt="" /> : <div className="ad-thumb" />}</td>
|
||||
<td><Link className="ad-rowlink" href={`/admin/produkte/${p.id}`}>{p.name}</Link><div className="body-sm ad-muted">{[p.sku, p.variants.length ? `${p.variants.length} Varianten` : ""].filter(Boolean).join(" · ")}</div></td>
|
||||
<td className="body-sm">{p.category?.name ?? "—"}</td>
|
||||
<td className="body-sm">{p.category ? labels.get(p.category.id) : "—"}</td>
|
||||
<td className="num">{formatPrice(p.price)}</td>
|
||||
<td className="num">{p.trackStock ? <Pill tone={stock <= 0 ? "danger" : stock <= 3 ? "gold" : "neutral"}>{stock}</Pill> : "—"}</td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { notFound } from "next/navigation";
|
||||
import { db } from "@/lib/db";
|
||||
import { sortedForSelect } from "@/lib/categories";
|
||||
import { requireAdmin } from "@/lib/auth";
|
||||
import { centsToInput, formatPrice } from "@/lib/money";
|
||||
import { toBerlinLocal } from "@/lib/berlin-time";
|
||||
|
|
@ -46,7 +47,7 @@ export default async function SalePage({ params, searchParams }: { params: Promi
|
|||
<SaleForm
|
||||
action={saveSale}
|
||||
initial={initial}
|
||||
categories={categories.map((c) => ({ id: c.id, name: c.name, detail: `${c._count.products} Produkte${c.active ? "" : " · ausgeblendet"}` }))}
|
||||
categories={sortedForSelect(categories).map((c) => ({ id: c.id, name: c.label, detail: `${c._count.products} Produkte${categories.some((k) => k.parentId === c.id) ? " · gilt auch für alle Unterkategorien" : ""}${c.active ? "" : " · ausgeblendet"}` }))}
|
||||
products={products.map((p) => ({ id: p.id, name: p.name, detail: [formatPrice(p.price), p.category?.name, p.active ? "" : "inaktiv"].filter(Boolean).join(" · "), price: p.price, categoryId: p.categoryId }))}
|
||||
/>
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import Link from "next/link";
|
||||
import { db } from "@/lib/db";
|
||||
import { categoryLabels } from "@/lib/categories";
|
||||
import { requireAdmin } from "@/lib/auth";
|
||||
import { dateFmt } from "@/lib/status";
|
||||
import { formatPrice } from "@/lib/money";
|
||||
|
|
@ -10,8 +11,8 @@ import { toggleSale } from "./actions";
|
|||
|
||||
export default async function SalesPage() {
|
||||
await requireAdmin("coupons.edit");
|
||||
const [sales, categories] = await Promise.all([db.sale.findMany({ orderBy: { createdAt: "desc" } }), db.category.findMany({ select: { id: true, name: true } })]);
|
||||
const catName = new Map(categories.map((c) => [c.id, c.name]));
|
||||
const [sales, categories] = await Promise.all([db.sale.findMany({ orderBy: { createdAt: "desc" } }), db.category.findMany({ select: { id: true, name: true, parentId: true } })]);
|
||||
const catName = categoryLabels(categories);
|
||||
const order: SaleState[] = ["running", "planned", "off", "ended"];
|
||||
const sorted = [...sales].sort((a, b) => order.indexOf(saleState(a)) - order.indexOf(saleState(b)));
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -11,18 +11,35 @@ function moveItem<T>(list: T[], i: number, d: number) {
|
|||
return next;
|
||||
}
|
||||
|
||||
export function NavEditor({ name, initial }: { name: string; initial: NavLink[] }) {
|
||||
export function NavEditor({ name, initial, rubrics = [] }: { name: string; initial: NavLink[]; rubrics?: { name: string; slug: string }[] }) {
|
||||
const [items, setItems] = useState(initial);
|
||||
const set = (i: number, k: keyof NavLink, v: string) => setItems((l) => l.map((x, j) => (j === i ? { ...x, [k]: v } : x)));
|
||||
// Rubrik wählen: setzt das Ziel und, wenn noch leer, den Text
|
||||
const pick = (i: number, slug: string) => {
|
||||
const r = rubrics.find((x) => x.slug === slug);
|
||||
if (r) setItems((l) => l.map((x, j) => (j === i ? { label: x.label.trim() ? x.label : r.name, href: `/kategorie/${r.slug}` } : x)));
|
||||
};
|
||||
return (
|
||||
<div>
|
||||
<input type="hidden" name={name} value={JSON.stringify(items.filter((i) => i.label.trim()))} />
|
||||
<table className="ad-variants">
|
||||
<thead><tr><th>Text</th><th>Ziel (z. B. /shop oder /kategorie/matten)</th><th /></tr></thead>
|
||||
<thead><tr><th>Text</th>{rubrics.length > 0 && <th>Rubrik</th>}<th>Ziel (z. B. /shop oder /kategorie/matten)</th><th /></tr></thead>
|
||||
<tbody>
|
||||
{items.map((it, i) => (
|
||||
<tr key={i}>
|
||||
<td><input className="sm-input" value={it.label} onChange={(e) => set(i, "label", e.target.value)} aria-label="Text" /></td>
|
||||
{rubrics.length > 0 && (
|
||||
<td>
|
||||
<span className="sm-select-wrap">
|
||||
<select className="sm-select" value={rubrics.find((r) => it.href === `/kategorie/${r.slug}`)?.slug ?? ""} onChange={(e) => pick(i, e.target.value)} aria-label="Rubrik">
|
||||
<option value="">Eigener Link</option>
|
||||
{rubrics.map((r) => (
|
||||
<option key={r.slug} value={r.slug}>{r.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</span>
|
||||
</td>
|
||||
)}
|
||||
<td><input className="sm-input" value={it.href} onChange={(e) => set(i, "href", e.target.value)} aria-label="Ziel" /></td>
|
||||
<td style={{ whiteSpace: "nowrap" }}>
|
||||
<button type="button" className="ad-iconbtn" onClick={() => setItems((l) => moveItem(l, i, -1))} aria-label="Nach oben" disabled={i === 0}><Icon name="arrowLeft" className="rot90" /></button>{" "}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export type ProductFormValues = {
|
|||
variants: VariantRow[];
|
||||
};
|
||||
|
||||
export function ProductForm({ values, categories, canStock }: { values: ProductFormValues; categories: Category[]; canStock: boolean }) {
|
||||
export function ProductForm({ values, categories, canStock }: { values: ProductFormValues; categories: (Pick<Category, "id" | "name"> & { label?: string })[]; canStock: boolean }) {
|
||||
return (
|
||||
<AdminForm action={saveProduct} submitLabel={values.id ? "Änderungen speichern" : "Produkt anlegen"}>
|
||||
{(state) => {
|
||||
|
|
@ -86,7 +86,7 @@ export function ProductForm({ values, categories, canStock }: { values: ProductF
|
|||
<div className="ad-card__body">
|
||||
<SelectField label="Kategorie" name="categoryId" defaultValue={values.categoryId}>
|
||||
<option value="">Keine</option>
|
||||
{categories.map((c) => <option key={c.id} value={c.id}>{c.name}</option>)}
|
||||
{categories.map((c) => <option key={c.id} value={c.id}>{c.label ?? c.name}</option>)}
|
||||
</SelectField>
|
||||
<SelectField label="Kennzeichnung" name="badge" defaultValue={values.badge} hint="Rabatt und „Ausverkauft“ erscheinen automatisch.">
|
||||
<option value="">Keine</option>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { NewsletterForm } from "./NewsletterForm";
|
|||
export async function Footer() {
|
||||
const [settings, categories, pages, payments] = await Promise.all([
|
||||
getSettings(),
|
||||
db.category.findMany({ where: { active: true }, orderBy: { sort: "asc" }, take: 5 }),
|
||||
db.category.findMany({ where: { active: true, parentId: null }, orderBy: { sort: "asc" }, take: 5 }),
|
||||
db.page.findMany({ where: { published: true, NOT: { showInFooter: "" } }, orderBy: { sort: "asc" } }),
|
||||
db.paymentMethod.findMany({ where: { enabled: true }, orderBy: { sort: "asc" } }),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,19 @@ import Link from "next/link";
|
|||
import { getCartCount } from "@/lib/cart";
|
||||
import { getCurrentUser } from "@/lib/auth";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { getCategoryTree } from "@/lib/categories";
|
||||
import { Icon } from "../Icon";
|
||||
import { MobileNav, NavLinks } from "./NavLinks";
|
||||
import { MobileNav, NavLinks, type NavItem } from "./NavLinks";
|
||||
import { ThemeToggle } from "../ThemeToggle";
|
||||
|
||||
export async function Header() {
|
||||
const [settings, count, user] = await Promise.all([getSettings(), getCartCount(), getCurrentUser()]);
|
||||
const [settings, count, user, tree] = await Promise.all([getSettings(), getCartCount(), getCurrentUser(), getCategoryTree(true)]);
|
||||
const a = settings.appearance;
|
||||
// Zeigt ein Menüpunkt auf eine Rubrik (Oberkategorie), klappen darunter ihre Unterkategorien auf
|
||||
const nav: NavItem[] = a.navigation.map((l) => {
|
||||
const rubric = tree.find((r) => l.href === `/kategorie/${r.slug}`);
|
||||
return rubric?.children.length ? { ...l, children: rubric.children.map((c) => ({ label: c.name, href: `/kategorie/${c.slug}` })) } : l;
|
||||
});
|
||||
return (
|
||||
<header className="sm-header" data-theme={a.darkHeader ? "dark" : undefined}>
|
||||
{(a.promoText || a.promoLinkLabel) && (
|
||||
|
|
@ -21,7 +27,7 @@ export async function Header() {
|
|||
<div className="sm-container sm-header__bar">
|
||||
<div style={{ display: "flex", alignItems: "center", gap: "var(--space-2)" }}>
|
||||
<MobileNav
|
||||
links={a.navigation}
|
||||
links={nav}
|
||||
extra={[
|
||||
{ label: user ? "Mein Konto" : "Anmelden", href: "/konto" },
|
||||
...(user?.role ? [{ label: "Admin", href: "/admin" }] : []),
|
||||
|
|
@ -35,7 +41,7 @@ export async function Header() {
|
|||
<span>{settings.general.shopName}.</span>
|
||||
</Link>
|
||||
</div>
|
||||
<NavLinks links={a.navigation} />
|
||||
<NavLinks links={nav} />
|
||||
<div className="sm-header__actions">
|
||||
<ThemeToggle />
|
||||
<Link className="sm-header__btn" href="/suche" aria-label="Suchen">
|
||||
|
|
|
|||
|
|
@ -1,29 +1,86 @@
|
|||
"use client";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { NavLink } from "@/lib/settings";
|
||||
import { Icon } from "../Icon";
|
||||
|
||||
/** Navigationspunkt, bei Rubriken mit ihren Unterkategorien als Menü. */
|
||||
export type NavItem = NavLink & { children?: NavLink[] };
|
||||
|
||||
function isActive(pathname: string, href: string) {
|
||||
if (href === "/") return pathname === "/";
|
||||
return pathname === href || pathname.startsWith(href + "/");
|
||||
}
|
||||
|
||||
export function NavLinks({ links }: { links: NavLink[] }) {
|
||||
export function NavLinks({ links }: { links: NavItem[] }) {
|
||||
const pathname = usePathname();
|
||||
const ref = useRef<HTMLElement>(null);
|
||||
// Nach dem Klick auf einen Menüpunkt bleibt der Fokus im Menü und hielte es offen
|
||||
useEffect(() => {
|
||||
const el = document.activeElement;
|
||||
if (el instanceof HTMLElement && ref.current?.contains(el)) el.blur();
|
||||
}, [pathname]);
|
||||
return (
|
||||
<nav className="sm-header__nav" aria-label="Hauptnavigation">
|
||||
{links.map((l) => (
|
||||
<Link key={l.href + l.label} href={l.href} aria-current={isActive(pathname, l.href) ? "page" : undefined}>
|
||||
{l.label}
|
||||
</Link>
|
||||
))}
|
||||
<nav className="sm-header__nav" aria-label="Hauptnavigation" ref={ref}>
|
||||
{links.map((l) => {
|
||||
const current = isActive(pathname, l.href) || !!l.children?.some((c) => isActive(pathname, c.href));
|
||||
const link = (
|
||||
<Link href={l.href} aria-current={current ? "page" : undefined}>
|
||||
{l.label}
|
||||
</Link>
|
||||
);
|
||||
if (!l.children?.length) return <span key={l.href + l.label} className="sm-navdrop">{link}</span>;
|
||||
return (
|
||||
<span key={l.href + l.label} className="sm-navdrop sm-navdrop--has">
|
||||
{link}
|
||||
{/* Öffnet bei Maus-Hover und bei Tastatur-Fokus */}
|
||||
<span className="sm-navdrop__menu">
|
||||
<Link href={l.href}>Alles aus {l.label}</Link>
|
||||
{l.children.map((c) => (
|
||||
<Link key={c.href} href={c.href} aria-current={isActive(pathname, c.href) ? "page" : undefined}>
|
||||
{c.label}
|
||||
</Link>
|
||||
))}
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export function MobileNav({ links, extra }: { links: NavLink[]; extra: NavLink[] }) {
|
||||
function MobileItem({ item, pathname }: { item: NavItem; pathname: string }) {
|
||||
const inside = !!item.children?.some((c) => isActive(pathname, c.href));
|
||||
const [open, setOpen] = useState(inside);
|
||||
const link = (
|
||||
<Link href={item.href} aria-current={isActive(pathname, item.href) ? "page" : undefined}>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
if (!item.children?.length) return link;
|
||||
return (
|
||||
<div className="sm-mnav__group">
|
||||
<div className="sm-mnav__row">
|
||||
{link}
|
||||
<button type="button" className="sm-mnav__toggle" aria-expanded={open} aria-label={`${item.label}: Unterkategorien ${open ? "schließen" : "öffnen"}`} onClick={() => setOpen((o) => !o)}>
|
||||
<Icon name={open ? "minus" : "plus"} size="sm" />
|
||||
</button>
|
||||
</div>
|
||||
{open && (
|
||||
<div className="sm-mnav__sub">
|
||||
{item.children.map((c) => (
|
||||
<Link key={c.href} href={c.href} aria-current={isActive(pathname, c.href) ? "page" : undefined}>
|
||||
{c.label}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function MobileNav({ links, extra }: { links: NavItem[]; extra: NavLink[] }) {
|
||||
const pathname = usePathname();
|
||||
const ref = useRef<HTMLDetailsElement>(null);
|
||||
useEffect(() => {
|
||||
|
|
@ -41,9 +98,7 @@ export function MobileNav({ links, extra }: { links: NavLink[]; extra: NavLink[]
|
|||
<Icon name="close" />
|
||||
</button>
|
||||
{[...links, ...extra].map((l) => (
|
||||
<Link key={l.href + l.label} href={l.href} aria-current={isActive(pathname, l.href) ? "page" : undefined}>
|
||||
{l.label}
|
||||
</Link>
|
||||
<MobileItem key={l.href + l.label} item={l} pathname={pathname} />
|
||||
))}
|
||||
</nav>
|
||||
</details>
|
||||
|
|
|
|||
|
|
@ -17,17 +17,20 @@ export async function ProductList({
|
|||
sort,
|
||||
showCategoryChips,
|
||||
activeCategory,
|
||||
chips,
|
||||
}: {
|
||||
basePath: string;
|
||||
where: Prisma.ProductWhereInput;
|
||||
sort?: string;
|
||||
showCategoryChips?: boolean;
|
||||
activeCategory?: string;
|
||||
// Eigene Filter-Chips, z. B. die Unterkategorien einer Rubrik
|
||||
chips?: { label: string; href: string; active: boolean }[];
|
||||
}) {
|
||||
const s = SORTS[sort ?? ""] ? sort! : "empfohlen";
|
||||
const [products, categories] = await Promise.all([
|
||||
db.product.findMany({ where: { active: true, ...where }, include: { variants: true }, orderBy: SORTS[s].orderBy }).then(withSales),
|
||||
showCategoryChips ? db.category.findMany({ where: { active: true }, orderBy: { sort: "asc" } }) : [],
|
||||
showCategoryChips && !chips ? db.category.findMany({ where: { active: true, parentId: null }, orderBy: { sort: "asc" } }) : [],
|
||||
]);
|
||||
// Nach Sale-Preis sortieren, nicht nach dem gespeicherten Preis
|
||||
if (s === "preis-auf") products.sort((a, b) => a.price - b.price);
|
||||
|
|
@ -35,7 +38,15 @@ export async function ProductList({
|
|||
return (
|
||||
<>
|
||||
<div className="sm-shop-toolbar">
|
||||
{showCategoryChips ? (
|
||||
{chips ? (
|
||||
<nav className="sm-chips" aria-label="Unterkategorien">
|
||||
{chips.map((c) => (
|
||||
<Link key={c.href} className={`sm-chip${c.active ? " is-active" : ""}`} href={c.href} aria-current={c.active ? "page" : undefined}>
|
||||
{c.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
) : showCategoryChips ? (
|
||||
<nav className="sm-chips" aria-label="Kategorien">
|
||||
<Link className={`sm-chip${!activeCategory ? " is-active" : ""}`} href="/shop">Alle</Link>
|
||||
{categories.map((c) => (
|
||||
|
|
|
|||
34
src/lib/categories.ts
Normal file
34
src/lib/categories.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import "server-only";
|
||||
import { cache } from "react";
|
||||
import type { Category } from "@prisma/client";
|
||||
import { db } from "./db";
|
||||
|
||||
export type CategoryNode = Category & { children: Category[] };
|
||||
|
||||
/** Alle Kategorien als Baum (Ober- mit Unterkategorien), sortiert. Einmal pro Anfrage geladen. */
|
||||
export const getCategoryTree = cache(async (onlyActive = false): Promise<CategoryNode[]> => {
|
||||
const all = await db.category.findMany({ where: onlyActive ? { active: true } : undefined, orderBy: [{ sort: "asc" }, { name: "asc" }] });
|
||||
const ids = new Set(all.map((c) => c.id));
|
||||
// Unterkategorien einer ausgeblendeten Oberkategorie rutschen nicht nach oben, sie fallen mit weg
|
||||
const roots = all.filter((c) => !c.parentId || (!ids.has(c.parentId) && !onlyActive));
|
||||
return roots.map((r) => ({ ...r, children: all.filter((c) => c.parentId === r.id) }));
|
||||
});
|
||||
|
||||
/** Die Kategorie selbst und alle ihre Unterkategorien. */
|
||||
export async function withSubcategories(id: string) {
|
||||
const children = await db.category.findMany({ where: { parentId: id }, select: { id: true } });
|
||||
return [id, ...children.map((c) => c.id)];
|
||||
}
|
||||
|
||||
/** "Matten › Reformer" für Auswahllisten im Admin. */
|
||||
export function categoryLabels(all: Pick<Category, "id" | "name" | "parentId">[]) {
|
||||
const byId = new Map(all.map((c) => [c.id, c]));
|
||||
return new Map(all.map((c) => [c.id, c.parentId && byId.get(c.parentId) ? `${byId.get(c.parentId)!.name} › ${c.name}` : c.name]));
|
||||
}
|
||||
|
||||
/** Kategorien in Baum-Reihenfolge (Oberkategorie, dann ihre Unterkategorien) mit Anzeigenamen. */
|
||||
export function sortedForSelect<T extends Pick<Category, "id" | "name" | "parentId" | "sort">>(all: T[]) {
|
||||
const labels = categoryLabels(all);
|
||||
const roots = all.filter((c) => !c.parentId || !all.some((p) => p.id === c.parentId)).sort((a, b) => a.sort - b.sort);
|
||||
return roots.flatMap((r) => [r, ...all.filter((c) => c.parentId === r.id).sort((a, b) => a.sort - b.sort)]).map((c) => ({ ...c, label: labels.get(c.id)! }));
|
||||
}
|
||||
|
|
@ -30,12 +30,18 @@ export function saleState(s: Pick<Sale, "active" | "startsAt" | "endsAt">, now =
|
|||
/** Laufende Sales, einmal pro Anfrage geladen. */
|
||||
export const getRunningSales = cache(async () => {
|
||||
const now = new Date();
|
||||
return db.sale.findMany({
|
||||
const sales = await db.sale.findMany({
|
||||
where: {
|
||||
active: true,
|
||||
AND: [{ OR: [{ startsAt: null }, { startsAt: { lte: now } }] }, { OR: [{ endsAt: null }, { endsAt: { gt: now } }] }],
|
||||
},
|
||||
});
|
||||
if (!sales.some((s) => s.scope === "categories")) return sales;
|
||||
// Sale auf eine Oberkategorie gilt auch für ihre Unterkategorien
|
||||
const subs = await db.category.findMany({ where: { parentId: { not: null } }, select: { id: true, parentId: true } });
|
||||
return sales.map((s) =>
|
||||
s.scope === "categories" ? { ...s, categoryIds: [...new Set([...s.categoryIds, ...subs.filter((c) => s.categoryIds.includes(c.parentId!)).map((c) => c.id)])] } : s,
|
||||
);
|
||||
});
|
||||
|
||||
function applies(s: Sale, product: { id: string; categoryId: string | null }) {
|
||||
|
|
|
|||
|
|
@ -302,3 +302,7 @@ a.ad-kpi:hover { border-color: var(--line-strong); }
|
|||
.ad-dialog__close:hover { background: var(--surface-sunken); color: var(--ink); }
|
||||
.ad-dialog__body { padding: var(--space-4) var(--space-5) var(--space-2); }
|
||||
.ad-dialog__body .ad-savebar { position: static; background: none; }
|
||||
|
||||
/* Unterkategorien eingerückt unter ihrer Oberkategorie */
|
||||
.ad-cat--sub { margin-left: var(--space-6); }
|
||||
@media (max-width: 640px) { .ad-cat--sub { margin-left: var(--space-4); } }
|
||||
|
|
|
|||
|
|
@ -255,3 +255,21 @@ button.sm-pdp__main { display: block; width: 100%; padding: 0; border: 0; cursor
|
|||
.sm-stockalert__note { margin: var(--space-2) 0 0; color: var(--ink-muted); }
|
||||
.sm-stockalert--done { display: flex; gap: var(--space-2); align-items: flex-start; color: var(--ink); }
|
||||
.sm-stockalert--done svg { color: var(--success); flex: none; margin-top: 3px; }
|
||||
|
||||
/* Rubriken: Unterkategorien als Menü unter dem Navigationspunkt */
|
||||
.sm-navdrop { position: relative; display: inline-flex; }
|
||||
.sm-navdrop__menu { position: absolute; top: 100%; left: 50%; z-index: 40; min-width: 220px; padding: var(--space-2) 0; background: var(--surface-raised); color: var(--ink); border: var(--hairline) solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; opacity: 0; visibility: hidden; transform: translate(-50%, 4px); transition: opacity 150ms, transform 150ms, visibility 0s 150ms; }
|
||||
.sm-navdrop--has:hover .sm-navdrop__menu, .sm-navdrop--has:focus-within .sm-navdrop__menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 150ms, transform 150ms; }
|
||||
.sm-header__nav .sm-navdrop__menu a { height: auto; min-height: 40px; padding: 0 var(--space-5); font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 400; color: var(--ink); white-space: nowrap; }
|
||||
.sm-header__nav .sm-navdrop__menu a::after { display: none; }
|
||||
.sm-header__nav .sm-navdrop__menu a:hover, .sm-header__nav .sm-navdrop__menu a[aria-current="page"] { background: var(--surface); color: var(--gold-deep); }
|
||||
.sm-header__nav .sm-navdrop__menu a:first-child { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 500; border-bottom: var(--hairline) solid var(--line); margin-bottom: var(--space-1); }
|
||||
.sm-mnav__row { display: flex; align-items: stretch; border-bottom: var(--hairline) solid var(--line); }
|
||||
.sm-mnav__row a { flex: 1; border-bottom: 0; }
|
||||
.sm-mnav__toggle { width: var(--touch-target); display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--ink); cursor: pointer; }
|
||||
.sm-mnav__sub { display: flex; flex-direction: column; padding-left: var(--space-4); }
|
||||
.sm-mnav__panel .sm-mnav__sub a { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 400; }
|
||||
.sm-rubric-hero { padding: var(--space-6) 0; }
|
||||
@media (min-width: 1024px) { .sm-rubric-hero { padding: var(--space-7) 0; } }
|
||||
.sm-rubric-hero .sm-hero__media img { width: 100%; aspect-ratio: 16 / 10; max-height: 380px; object-fit: cover; display: block; }
|
||||
.sm-rubric-hero .sm-crumbs a { color: inherit; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue