cs-2022-class-profile/components/Sections.tsx

46 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-09-01 01:40:05 -04:00
import React from "react";
import styles from "./Sections.module.css";
interface SectionsData {
name: string;
url: string;
}
interface SectionsProps {
2022-09-07 22:59:41 -04:00
/* Whether to display the "Sections" title and separator that appears on the left. */
showHeader?: boolean;
2022-09-01 01:40:05 -04:00
data: SectionsData[];
}
2022-09-07 22:59:41 -04:00
export function Sections({ data, showHeader = true }: SectionsProps) {
2022-09-01 01:40:05 -04:00
return (
2022-09-01 02:09:19 -04:00
<section className={styles.sections}>
2022-09-07 22:59:41 -04:00
{showHeader ? (
<>
<h1>Sections</h1>
<div className={styles.separator} />
</>
) : (
""
)}
2022-09-01 02:09:19 -04:00
<nav className={styles.nav}>
2022-09-09 17:29:24 -04:00
<ul>
{data.map((datum, index) => {
return (
<li key={`${datum.name}-${index}`}>
<a href={datum.url}>
<span className={styles.linkNumber}>
{String(index).padStart(2, "0")}{" "}
</span>
<span className={styles.linkName}>{datum.name}</span>
</a>
</li>
);
})}
</ul>
2022-09-01 02:09:19 -04:00
</nav>
2022-09-01 01:40:05 -04:00
</section>
);
}