1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-27 08:58:30 -04:00

prepare for new next/link behavior

see new-next-link branch
This commit is contained in:
Jake Jarvis 2022-04-28 12:32:50 -04:00
parent ad1d1bbce1
commit e1da53a1fe
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
9 changed files with 13 additions and 16 deletions

View File

@ -260,7 +260,7 @@ const ContactForm = ({ className }: ContactFormProps) => {
Markdown syntax Markdown syntax
</Link>{" "} </Link>{" "}
is allowed here, e.g.: <strong>**bold**</strong>, <em>_italics_</em>, [ is allowed here, e.g.: <strong>**bold**</strong>, <em>_italics_</em>, [
<Link href="https://jarv.is" fancy={false} forceNewWindow> <Link href="https://jarv.is" underline={false} forceNewWindow>
links links
</Link> </Link>
](https://jarv.is), and <code>`code`</code>. ](https://jarv.is), and <code>`code`</code>.

View File

@ -63,7 +63,7 @@ const CustomImage = ({
return ( return (
<Wrapper className={className}> <Wrapper className={className}>
{href ? ( {href ? (
<Link href={href} fancy={false}> <Link href={href} underline={false}>
{img} {img}
</Link> </Link>
) : ( ) : (

View File

@ -10,7 +10,7 @@ const FancyLink = styled("a", {
variants: { variants: {
// fancy animated link underline effect // fancy animated link underline effect
fancy: { underline: {
true: { true: {
// sets psuedo linear-gradient() for the underline's color; see stitches config for the weird calculation behind the // sets psuedo linear-gradient() for the underline's color; see stitches config for the weird calculation behind the
// local `$$underline` variable. // local `$$underline` variable.
@ -30,7 +30,7 @@ const FancyLink = styled("a", {
}, },
defaultVariants: { defaultVariants: {
fancy: true, underline: true,
}, },
}); });

View File

@ -1,5 +1,5 @@
import { ErrorBoundary } from "react-error-boundary"; import { ErrorBoundary } from "react-error-boundary";
import Link from "next/link"; import NextLink from "next/link";
import Time from "../Time"; import Time from "../Time";
import HitCounter from "../HitCounter"; import HitCounter from "../HitCounter";
import NoteTitle from "../NoteTitle"; import NoteTitle from "../NoteTitle";
@ -62,7 +62,7 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
<> <>
<Wrapper> <Wrapper>
<MetaItem> <MetaItem>
<Link <NextLink
href={{ href={{
pathname: "/notes/[slug]/", pathname: "/notes/[slug]/",
query: { slug }, query: { slug },
@ -75,7 +75,7 @@ const NoteMeta = ({ slug, date, title, htmlTitle, tags = [] }: NoteMetaProps) =>
</span> </span>
<Time date={date} format="MMMM D, YYYY" /> <Time date={date} format="MMMM D, YYYY" />
</MetaLink> </MetaLink>
</Link> </NextLink>
</MetaItem> </MetaItem>
{tags.length > 0 && ( {tags.length > 0 && (

View File

@ -113,7 +113,7 @@ const getSiteStats = async (client: faunadb.Client) => {
pages, pages,
}; };
pages.map((page) => { pages.forEach((page) => {
// match URLs from RSS feed with db to populate some metadata // match URLs from RSS feed with db to populate some metadata
const match = notes.find((note) => `notes/${note.slug}` === page.slug); const match = notes.find((note) => `notes/${note.slug}` === page.slug);
if (match) { if (match) {

View File

@ -5,12 +5,10 @@ const ColorfulLink = ({
lightColor, lightColor,
darkColor, darkColor,
css, css,
fancy = true,
...rest ...rest
}: CustomLinkProps & { }: CustomLinkProps & {
lightColor: string; lightColor: string;
darkColor: string; darkColor: string;
fancy?: boolean;
}) => { }) => {
return ( return (
<Link <Link
@ -25,7 +23,6 @@ const ColorfulLink = ({
...css, ...css,
}} }}
fancy={fancy}
{...rest} {...rest}
/> />
); );
@ -319,7 +316,7 @@ const Index = () => (
title="My Public Key" title="My Public Key"
lightColor="#757575" lightColor="#757575"
darkColor="#959595" darkColor="#959595"
fancy={false} underline={false}
forceNewWindow forceNewWindow
> >
🔐 <PGPKey>2B0C 9CF2 51E6 9A39</PGPKey> 🔐 <PGPKey>2B0C 9CF2 51E6 9A39</PGPKey>

View File

@ -25,7 +25,7 @@ export const getStaticProps: GetStaticProps = async () => {
const notes = await getAllNotes(); const notes = await getAllNotes();
const notesByYear: NotesListProps["notesByYear"] = {}; const notesByYear: NotesListProps["notesByYear"] = {};
notes.map((note) => { notes.forEach((note) => {
const year = new Date(note.date).getUTCFullYear(); const year = new Date(note.date).getUTCFullYear();
(notesByYear[year] || (notesByYear[year] = [])).push(note); (notesByYear[year] || (notesByYear[year] = [])).push(note);
}); });

View File

@ -33,7 +33,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
// push notes separately and use their metadata // push notes separately and use their metadata
const notes = await getAllNotes(); const notes = await getAllNotes();
notes.map((note) => notes.forEach((note) =>
pages.push({ pages.push({
loc: urlJoin("/notes/", note.slug, "/"), loc: urlJoin("/notes/", note.slug, "/"),
// pull lastMod from front matter date // pull lastMod from front matter date
@ -43,7 +43,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
); );
// make all relative URLs absolute // 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 // cache on edge for 12 hours
const { res } = context; const { res } = context;

View File

@ -35,7 +35,7 @@ const Stats = () => (
<Content> <Content>
<PoweredBy> <PoweredBy>
Powered by{" "} Powered by{" "}
<Link href="https://usefathom.com/ref/ZEYG0O" fancy={false}> <Link href="https://usefathom.com/ref/ZEYG0O" underline={false}>
<FathomIcon /> Fathom Analytics <FathomIcon /> Fathom Analytics
</Link> </Link>
</PoweredBy> </PoweredBy>