add order
This commit is contained in:
parent
c4a8ccf68d
commit
cbbd5d4ad5
|
@ -6,15 +6,19 @@ import { MDXRemoteSerializeResult } from "next-mdx-remote";
|
|||
import { serialize } from "next-mdx-remote/serialize";
|
||||
|
||||
const EVENTS_PATH = path.join("content", "events");
|
||||
const TERMS = ["winter", "spring", "fall"];
|
||||
|
||||
export async function getYears(): Promise<string[]> {
|
||||
return (await fs.readdir(EVENTS_PATH, { withFileTypes: true }))
|
||||
.filter((dirent) => dirent.isDirectory())
|
||||
.map((dirent) => dirent.name);
|
||||
.map((dirent) => dirent.name)
|
||||
.sort();
|
||||
}
|
||||
|
||||
export async function getTermsByYear(year: string): Promise<string[]> {
|
||||
return await fs.readdir(path.join(EVENTS_PATH, year));
|
||||
return (await fs.readdir(path.join(EVENTS_PATH, year))).sort(
|
||||
(a, b) => TERMS.indexOf(a) - TERMS.indexOf(b)
|
||||
);
|
||||
}
|
||||
|
||||
interface Metadata {
|
||||
|
|
|
@ -15,7 +15,6 @@ export async function getStaticPaths(): Promise<{
|
|||
const paths = years.map((curYear) => ({
|
||||
params: { year: curYear },
|
||||
}));
|
||||
console.log(paths);
|
||||
return {
|
||||
paths: paths,
|
||||
fallback: false,
|
||||
|
@ -56,7 +55,7 @@ const Year = (props: Props) => {
|
|||
<hr />
|
||||
<div className={styles.links}>
|
||||
{props.terms.map((term) => (
|
||||
<Link key={term} href={`./${props.year}/${term}`}>
|
||||
<Link key={term} href={`events/${props.year}/${term}`}>
|
||||
{`${term.charAt(0).toUpperCase()}${term.slice(1)}`}
|
||||
</Link>
|
||||
))}
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
.heading2 {
|
||||
font-weight: 700;
|
||||
font-size: 2.25rem;
|
||||
color: var(--purple-2);
|
||||
color: var(--primary-heading);
|
||||
}
|
||||
|
||||
.blue {
|
||||
color: var(--blue-2)
|
||||
color: var(--primary-accent)
|
||||
}
|
||||
|
||||
.links {
|
||||
|
|
Loading…
Reference in New Issue