import type { Component } from "solid-js";
import { For } from "solid-js";
import { A } from "@solidjs/router";
import type { DashboardHeroData } from "../shared/dashboard-types";
import styles from "./dashboard-hero.module.scss";

type DashboardHeroProps = DashboardHeroData;

const DashboardHero: Component<DashboardHeroProps> = (props) => {
	return (
		<section class={styles.heroGrid}>
			<div class={styles.heroCard}>
				<div class={styles.heroCopy}>
					<p class={styles.eyebrow}>{props.heroSummary.eyebrow}</p>
					<h1>{props.heroSummary.title}</h1>
					<p>{props.heroSummary.description}</p>

					<div class={styles.metricRow}>
						<For each={props.spotlightStats}>
							{(stat) => (
								<div class={styles.metricPill}>
									<span classList={{ [styles.metricIcon]: true, [styles[stat.tone]]: true }}>{stat.label.slice(0, 1)}</span>
									<div>
										<p>{stat.label}</p>
										<strong>{stat.value}</strong>
									</div>
								</div>
							)}
						</For>
					</div>
				</div>

				<div class={styles.heroVisual} aria-hidden="true">
					<div class={styles.orbit}></div>
					<For each={props.heroSummary.visualBadges}>{(badge) => <div class={styles.visualCard}>{badge}</div>}</For>
				</div>
			</div>

			<div class={styles.sideCard}>
				<h2>{props.heroSideCard.title}</h2>
				<p>{props.heroSideCard.description}</p>
				<A href={props.heroSideCard.buttonHref} class={styles.sideCardAction}>
					{props.heroSideCard.buttonLabel}
				</A>

				<div class={styles.quickStats}>
					<For each={props.quickStats}>
						{(stat) => (
							<div class={styles.statCard}>
								<p>{stat.label}</p>
								<strong>{stat.value}</strong>
							</div>
						)}
					</For>
				</div>
			</div>
		</section>
	);
};

export default DashboardHero;
