mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-11-20 19:40:52 -05:00
organize types a bit more sanely & bump deps
This commit is contained in:
@@ -72,7 +72,7 @@ const App = ({ Component, pageProps }: AppProps) => {
|
||||
<>
|
||||
{/* static asset preloads */}
|
||||
<Head>
|
||||
{/* TODO: these hrefs will change at some point (and possibly unpredictably). find a better way... */}
|
||||
{/* TODO: these hrefs will change (unpredictably?) at some point. find a safer way to get them from webpack. */}
|
||||
<link
|
||||
rel="preload"
|
||||
as="font"
|
||||
@@ -89,7 +89,7 @@ const App = ({ Component, pageProps }: AppProps) => {
|
||||
/>
|
||||
</Head>
|
||||
|
||||
{/* all SEO config is in ./lib/seo.ts except for canonical URLs, which require access to next router */}
|
||||
{/* all SEO config is in ../lib/seo.ts except for canonical URLs, which require access to next router */}
|
||||
<DefaultSeo
|
||||
{...defaultSeo}
|
||||
canonical={canonical}
|
||||
@@ -103,6 +103,7 @@ const App = ({ Component, pageProps }: AppProps) => {
|
||||
/>
|
||||
<SocialProfileJsonLd {...socialProfileJsonLd} />
|
||||
|
||||
{/* NOTE: this *must* come last in this fragment */}
|
||||
<ThemeProvider>{getLayout(<Component {...pageProps} />)}</ThemeProvider>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -4,7 +4,6 @@ import { MDXRemote } from "next-mdx-remote";
|
||||
import { htmlEscape } from "escape-goat";
|
||||
import Content from "../../components/Content/Content";
|
||||
import NoteMeta from "../../components/NoteMeta/NoteMeta";
|
||||
import NoteTitle from "../../components/NoteTitle/NoteTitle";
|
||||
import Comments from "../../components/Comments/Comments";
|
||||
import * as mdxComponents from "../../lib/mdx-components";
|
||||
import { getNote, getNoteSlugs } from "../../lib/parse-notes";
|
||||
@@ -51,15 +50,15 @@ const Note = ({ frontMatter, source }: NoteType) => {
|
||||
{...articleJsonLd}
|
||||
/>
|
||||
|
||||
<NoteMeta slug={frontMatter.slug} date={frontMatter.date} title={frontMatter.title} tags={frontMatter.tags} />
|
||||
<NoteTitle slug={frontMatter.slug} htmlTitle={frontMatter.htmlTitle} />
|
||||
<NoteMeta {...frontMatter} />
|
||||
|
||||
<Content>
|
||||
{/* @ts-ignore */}
|
||||
<MDXRemote {...source} components={{ ...mdxComponents }} />
|
||||
</Content>
|
||||
|
||||
{frontMatter.noComments !== true && (
|
||||
{/* comments can be disabled for an individual post via `noComments: true` in its front matter */}
|
||||
{!frontMatter.noComments && (
|
||||
<InView rootMargin="140px" triggerOnce fallbackInView>
|
||||
{({ inView, ref }) => (
|
||||
<div id="comments" ref={ref}>
|
||||
@@ -72,8 +71,8 @@ const Note = ({ frontMatter, source }: NoteType) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getStaticProps: GetStaticProps = async ({ params }) => {
|
||||
const { frontMatter, source } = await getNote(params.slug as string);
|
||||
export const getStaticProps: GetStaticProps = async ({ params }: { params: Pick<NoteType["frontMatter"], "slug"> }) => {
|
||||
const { frontMatter, source } = await getNote(params.slug);
|
||||
|
||||
return {
|
||||
props: {
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import RepositoryCard from "../components/RepositoryCard/RepositoryCard";
|
||||
import { OctocatOcticon } from "../components/Icons";
|
||||
import { authorSocial } from "../lib/config";
|
||||
import type { GetStaticProps } from "next";
|
||||
import type { RepoType } from "../types";
|
||||
import type { RepositoryType } from "../types";
|
||||
|
||||
const Projects = ({ repos }) => (
|
||||
<>
|
||||
@@ -22,7 +22,7 @@ const Projects = ({ repos }) => (
|
||||
|
||||
<Content>
|
||||
<div className="wrapper">
|
||||
{repos.map((repo: RepoType) => (
|
||||
{repos.map((repo: RepositoryType) => (
|
||||
<div key={repo.name} className="card">
|
||||
<RepositoryCard {...repo} />
|
||||
</div>
|
||||
@@ -116,7 +116,7 @@ export const getStaticProps: GetStaticProps = async () => {
|
||||
}
|
||||
);
|
||||
|
||||
const repos: RepoType[] = user.repositories.edges.map(({ node: repo }) => ({
|
||||
const repos: RepositoryType[] = user.repositories.edges.map(({ node: repo }) => ({
|
||||
name: repo.name,
|
||||
url: repo.url,
|
||||
description: repo.description,
|
||||
|
||||
Reference in New Issue
Block a user