import Link from "next/link"; import { format, parseISO } from "date-fns"; import groupBy from "lodash.groupby"; import styles from "./List.module.scss"; type NoteProps = { title: string; date: string; slug: string; }; const List = ({ notes }) => { const notesByYear = groupBy(notes, "year"); const sections = []; Object.entries(notesByYear).forEach(([year, yearNotes]: [string, NoteProps[]]) => { sections.push(

{year}

); }); // grouped notes enter this component ordered chronologically -- we want reverse chronological const reversed = sections.reverse(); return <>{reversed}; }; export default List;