// Path: Frontend/src/components/assignment/shared/assignment-header.tsx

import { A } from "@solidjs/router";
import type { Component } from "solid-js";
import { getDashboardHomeHref } from "../../../lib/routes";
import styles from "./assignment-header.module.scss";
import type { AssignmentPageData } from "./assignment-types";

type Props = {
	data: AssignmentPageData;
	backHref?: string;
};

const AssignmentHeader: Component<Props> = (props) => {
	return (
		<section class={styles.headerCard}>
			<div class={styles.headerTop}>
				<A href={props.backHref ?? getDashboardHomeHref("student")} class={styles.backLink}>
					Back to dashboard
				</A>
				<span class={styles.statusPill}>{props.data.statusLabel}</span>
			</div>

			<div class={styles.copy}>
				<p class={styles.eyebrow}>{props.data.classroomName}</p>
				<h1>{props.data.title}</h1>
				<p>{props.data.headline}</p>
				<p class={styles.description}>{props.data.description}</p>
			</div>
		</section>
	);
};

export default AssignmentHeader;
