import type { Component } from "solid-js";
import { For } from "solid-js";
import { A } from "@solidjs/router";
import type { DashboardPracticeData } from "./dashboard-practice.data";
import styles from "./dashboard-practice-focus.module.scss";

type DashboardPracticeFocusProps = DashboardPracticeData;

const DashboardPracticeFocus: Component<DashboardPracticeFocusProps> = (props) => {
	return (
		<section class={styles.section}>
			<article class={styles.heroCard}>
				<div class={styles.heroCopy}>
					<p class={styles.eyebrow}>{props.hero.eyebrow}</p>
					<h1>{props.hero.title}</h1>
					<p>{props.hero.description}</p>
				</div>

				<div class={styles.statGrid}>
					<For each={props.hero.stats}>
						{(stat) => (
							<div class={styles.statCard}>
								<strong>{stat.value}</strong>
								<span>{stat.label}</span>
							</div>
						)}
					</For>
				</div>
			</article>

			<div class={styles.cardGrid}>
				<For each={props.cards}>
					{(card) => (
						<article class={styles.practiceCard}>
							<span classList={{ [styles.toneChip]: true, [styles[card.tone]]: true }}>{card.meta}</span>

							<div class={styles.cardBody}>
								<h2>{card.title}</h2>
								<p>{card.description}</p>
							</div>

							<div class={styles.cardActions}>
								<A href={card.primaryHref} class={styles.primaryAction}>
									{card.primaryLabel}
								</A>
								<A href={card.secondaryHref} class={styles.secondaryAction}>
									{card.secondaryLabel}
								</A>
							</div>
						</article>
					)}
				</For>
			</div>
		</section>
	);
};

export default DashboardPracticeFocus;
