From e1da53a1fe638808a2eda0e9f597f3e9263576ff Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Thu, 28 Apr 2022 12:32:50 -0400 Subject: [PATCH] prepare for new `next/link` behavior see new-next-link branch --- components/ContactForm/ContactForm.tsx | 2 +- components/Image/Image.tsx | 2 +- components/Link/Link.tsx | 4 ++-- components/NoteMeta/NoteMeta.tsx | 6 +++--- pages/api/hits.ts | 2 +- pages/index.tsx | 5 +---- pages/notes/index.tsx | 2 +- pages/sitemap.xml.ts | 4 ++-- pages/stats.tsx | 2 +- 9 files changed, 13 insertions(+), 16 deletions(-) diff --git a/components/ContactForm/ContactForm.tsx b/components/ContactForm/ContactForm.tsx index c19aacc3..10123f3a 100644 --- a/components/ContactForm/ContactForm.tsx +++ b/components/ContactForm/ContactForm.tsx @@ -260,7 +260,7 @@ const ContactForm = ({ className }: ContactFormProps) => { Markdown syntax {" "} is allowed here, e.g.: **bold**, _italics_, [ - + links ](https://jarv.is), and `code`. diff --git a/components/Image/Image.tsx b/components/Image/Image.tsx index 4d79555a..8e45051a 100644 --- a/components/Image/Image.tsx +++ b/components/Image/Image.tsx @@ -63,7 +63,7 @@ const CustomImage = ({ return ( {href ? ( - + {img} ) : ( diff --git a/components/Link/Link.tsx b/components/Link/Link.tsx index 5366d695..cd946281 100644 --- a/components/Link/Link.tsx +++ b/components/Link/Link.tsx @@ -10,7 +10,7 @@ const FancyLink = styled("a", { variants: { // fancy animated link underline effect - fancy: { + underline: { true: { // sets psuedo linear-gradient() for the underline's color; see stitches config for the weird calculation behind the // local `$$underline` variable. @@ -30,7 +30,7 @@ const FancyLink = styled("a", { }, defaultVariants: { - fancy: true, + underline: true, }, }); diff --git a/components/NoteMeta/NoteMeta.tsx b/components/NoteMeta/NoteMeta.tsx index 1e83f79f..281ad445 100644 --- a/components/NoteMeta/NoteMeta.tsx +++ b/components/NoteMeta/NoteMeta.tsx @@ -1,5 +1,5 @@ import { ErrorBoundary } from "react-error-boundary"; -import Link from "next/link"; +import NextLink from "next/link"; import Time from "../Time"; import HitCounter from "../HitCounter"; import NoteTitle from "../NoteTitle"; @@ -62,7 +62,7 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) => <> - {tags.length > 0 && ( diff --git a/pages/api/hits.ts b/pages/api/hits.ts index 89f046ac..fba35743 100644 --- a/pages/api/hits.ts +++ b/pages/api/hits.ts @@ -113,7 +113,7 @@ const getSiteStats = async (client: faunadb.Client) => { pages, }; - pages.map((page) => { + pages.forEach((page) => { // match URLs from RSS feed with db to populate some metadata const match = notes.find((note) => `notes/${note.slug}` === page.slug); if (match) { diff --git a/pages/index.tsx b/pages/index.tsx index b444a377..b241c6bd 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -5,12 +5,10 @@ const ColorfulLink = ({ lightColor, darkColor, css, - fancy = true, ...rest }: CustomLinkProps & { lightColor: string; darkColor: string; - fancy?: boolean; }) => { return ( ); @@ -319,7 +316,7 @@ const Index = () => ( title="My Public Key" lightColor="#757575" darkColor="#959595" - fancy={false} + underline={false} forceNewWindow > 🔐 2B0C 9CF2 51E6 9A39 diff --git a/pages/notes/index.tsx b/pages/notes/index.tsx index 112fcb86..092809c8 100644 --- a/pages/notes/index.tsx +++ b/pages/notes/index.tsx @@ -25,7 +25,7 @@ export const getStaticProps: GetStaticProps = async () => { const notes = await getAllNotes(); const notesByYear: NotesListProps["notesByYear"] = {}; - notes.map((note) => { + notes.forEach((note) => { const year = new Date(note.date).getUTCFullYear(); (notesByYear[year] || (notesByYear[year] = [])).push(note); }); diff --git a/pages/sitemap.xml.ts b/pages/sitemap.xml.ts index a98ff7c4..93a1dea2 100644 --- a/pages/sitemap.xml.ts +++ b/pages/sitemap.xml.ts @@ -33,7 +33,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { // push notes separately and use their metadata const notes = await getAllNotes(); - notes.map((note) => + notes.forEach((note) => pages.push({ loc: urlJoin("/notes/", note.slug, "/"), // pull lastMod from front matter date @@ -43,7 +43,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { ); // make all relative URLs absolute - pages.map((page) => (page.loc = urlJoin(baseUrl, page.loc))); + pages.forEach((page) => (page.loc = urlJoin(baseUrl, page.loc))); // cache on edge for 12 hours const { res } = context; diff --git a/pages/stats.tsx b/pages/stats.tsx index e3a61412..a2b07ca5 100644 --- a/pages/stats.tsx +++ b/pages/stats.tsx @@ -35,7 +35,7 @@ const Stats = () => ( Powered by{" "} - + Fathom Analytics