MBO-Tech-IT-Webseite/components/page/Blocks.tsx

192 lines
4.1 KiB
TypeScript

import type { ReactNode } from "react";
import Link from "next/link";
import { ArrowRight, Check } from "lucide-react";
import Header from "@/components/Header";
import Footer from "@/components/Footer";
import MobileContactBar from "@/components/MobileContactBar";
/* Gemeinsame Bausteine der Unterseiten (Theme Cobalt, Markenfarben). */
export type Tone = "warm" | "cool";
export function PageShell({ children }: { children: ReactNode }) {
return (
<main className="site pb-16 lg:pb-0">
<Header />
{children}
<Footer />
<MobileContactBar />
</main>
);
}
export function PageHead({
title,
lead,
crumbs,
actions,
badge,
}: {
title: ReactNode;
lead?: ReactNode;
crumbs?: { label: string; href?: string }[];
actions?: ReactNode;
badge?: ReactNode;
}) {
return (
<header className="pagehead">
<div className="wrap pagehead__inner">
{crumbs && (
<nav aria-label="Brotkrumen" className="crumbs">
<Link href="/">Startseite</Link>
{crumbs.map((c) => (
<span key={c.label} className="crumbs">
<span aria-hidden="true">/</span>
{c.href ? <Link href={c.href}>{c.label}</Link> : <span aria-current="page">{c.label}</span>}
</span>
))}
</nav>
)}
{badge}
<h1 className="page-title">{title}</h1>
{lead && <p className="lead">{lead}</p>}
{actions && <div className="actions">{actions}</div>}
</div>
</header>
);
}
export function Sub({
title,
lead,
band = false,
id,
children,
}: {
title?: ReactNode;
lead?: ReactNode;
band?: boolean;
id?: string;
children: ReactNode;
}) {
return (
<section id={id} className={band ? "subsec band" : "subsec"}>
<div className="wrap">
{title && (
<div className={lead ? "head head--split" : "head"}>
<h2>{title}</h2>
{lead && <p className="lead">{lead}</p>}
</div>
)}
{children}
</div>
</section>
);
}
export function Offer({
tone = "warm",
title,
badge,
text,
chips,
actions,
price,
}: {
tone?: Tone;
title: ReactNode;
badge?: string;
text: ReactNode;
chips?: string[];
actions: ReactNode;
price: { was?: string; value: string; note: string };
}) {
return (
<div className={tone === "cool" ? "offer offer--cool" : "offer"}>
<div className="offer__body">
{badge && <span className="badge">{badge}</span>}
<h2>{title}</h2>
<p>{text}</p>
{chips && (
<ul className="chips">
{chips.map((c) => (
<li key={c}>{c}</li>
))}
</ul>
)}
<div className="actions">{actions}</div>
</div>
<div className="pricebox">
{price.was && <s>{price.was}</s>}
<b>{price.value}</b>
<span>{price.note}</span>
</div>
</div>
);
}
export function LinkCard({
href,
tone = "warm",
icon,
title,
text,
meta,
headingLevel = "h2",
}: {
href: string;
tone?: Tone;
icon?: ReactNode;
title: string;
text: ReactNode;
meta: string;
headingLevel?: "h2" | "h3";
}) {
const H = headingLevel;
return (
<Link href={href} className={`card card--${tone}`}>
<span className="card__top">
{icon}
<H>{title}</H>
</span>
<p>{text}</p>
<span className="card__meta">
{meta}
<ArrowRight className="icon--s" aria-hidden="true" />
</span>
</Link>
);
}
export function CheckList({ items }: { items: string[] }) {
return (
<ul className="checks">
{items.map((item) => (
<li key={item}>
<Check className="icon--s" aria-hidden="true" />
<span>{item}</span>
</li>
))}
</ul>
);
}
export function Consult({
children,
cta = "Kostenloses Erstgespräch anfragen",
href = "/#contact",
}: {
children: ReactNode;
cta?: string;
href?: string;
}) {
return (
<div className="consult">
<p>{children}</p>
<Link href={href} className="btn-primary btn-lg">
{cta}
</Link>
</div>
);
}