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