1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 01:41:19 -04:00

organize types a bit more sanely & bump deps

This commit is contained in:
2022-02-24 07:06:34 -05:00
parent d24d29a04e
commit e6f1955efb
16 changed files with 267 additions and 645 deletions

View File

@@ -1,11 +1,11 @@
import { NextSeo } from "next-seo";
import { format } from "date-fns";
import Content from "../../components/Content/Content";
import NotesList from "../../components/NotesList/NotesList";
import NotesList, { NotesListProps } from "../../components/NotesList/NotesList";
import { getAllNotes } from "../../lib/parse-notes";
import type { GetStaticProps } from "next";
const Notes = ({ notesByYear }) => (
const Notes = ({ notesByYear }: NotesListProps) => (
<>
<NextSeo
title="Notes"
@@ -23,9 +23,10 @@ const Notes = ({ notesByYear }) => (
export const getStaticProps: GetStaticProps = async () => {
// parse the year of each note and group them together
const notesByYear = {};
const notesByYear: NotesListProps["notesByYear"] = {};
getAllNotes().map((note) => {
const year = Number.parseInt(format(new Date(note.date), "yyyy"));
const year = format(new Date(note.date), "yyyy");
(notesByYear[year] || (notesByYear[year] = [])).push(note);
});