78 lines
2.5 KiB
TypeScript
78 lines
2.5 KiB
TypeScript
import type { CSSProperties } from "react";
|
|
import AsciiField from "./AsciiField";
|
|
|
|
interface HeroProps {
|
|
eyebrowText?: string;
|
|
headline1?: string;
|
|
subtext1?: string;
|
|
subtext2?: string;
|
|
cta1Text?: string;
|
|
cta1Href?: string;
|
|
cta2Text?: string;
|
|
cta2Href?: string;
|
|
bgImagePath?: string | null;
|
|
badges?: string[];
|
|
}
|
|
|
|
// Senkrechte Lage der Stack-Labels; das ASCII-Feld führt seine Leitungen genau dorthin.
|
|
function labelY(i: number, n: number) {
|
|
if (n <= 1) return "50%";
|
|
return `${30 + (i * 40) / (n - 1)}%`;
|
|
}
|
|
|
|
export default function Hero({
|
|
headline1 = "Ihr IT-Service in Crailsheim.",
|
|
subtext1 = "Ihr IT-Dienstleister in Crailsheim, egal ob zu Hause oder im Büro. Von Hard- & Software über Netzwerk & WLAN bis hin zu Webseiten & Webanwendungen: Wir lösen Ihre IT-Probleme persönlich und zum fairen Preis.",
|
|
subtext2 = "",
|
|
cta1Text = "Jetzt anfragen",
|
|
cta1Href = "#contact",
|
|
cta2Text = "Unsere Leistungen",
|
|
cta2Href = "/services",
|
|
bgImagePath = null,
|
|
badges = ["Docker", "Proxmox", "Hetzner Cloud", "Linux"],
|
|
}: HeroProps = {}) {
|
|
return (
|
|
<section className="hero" aria-labelledby="hero-title">
|
|
{bgImagePath && (
|
|
<div className="hero__photo" data-slot="hero" data-alt="Hintergrundbild aus der Verwaltung (hero-bilder)">
|
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
<img
|
|
src={`${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/hero-bilder/${bgImagePath}`}
|
|
alt=""
|
|
fetchPriority="high"
|
|
/>
|
|
</div>
|
|
)}
|
|
|
|
<AsciiField />
|
|
|
|
<div className="wrap grid12 hero__content">
|
|
<div className="hero__text">
|
|
<h1 id="hero-title">{headline1}</h1>
|
|
{subtext1 && <p className="hero__sub">{subtext1}</p>}
|
|
{subtext2 && <p className="hero__sub">{subtext2}</p>}
|
|
|
|
<div className="hero__actions">
|
|
<a href={cta1Href} className="btn-primary btn-lg">
|
|
{cta1Text}
|
|
</a>
|
|
<a href={cta2Href === "#services" ? "/services" : cta2Href} className="btn-secondary btn-lg">
|
|
{cta2Text}
|
|
</a>
|
|
</div>
|
|
|
|
{badges.length > 0 && (
|
|
<ul className="hero__stack" aria-label="Technik, mit der wir arbeiten">
|
|
{badges.map((badge, i) => (
|
|
<li key={badge} style={{ "--y": labelY(i, badges.length) } as CSSProperties}>
|
|
{badge}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
}
|