1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-01-11 02:22:55 -05:00

move <Layout> to _app.tsx so it's not rerendered

This commit is contained in:
2022-01-07 09:57:32 -05:00
parent 34d2304e7c
commit 354d767fc5
15 changed files with 388 additions and 328 deletions

View File

@@ -1,26 +1,15 @@
import { NextSeo } from "next-seo"; import Header from "./page-header/Header";
import Footer from "./page-footer/Footer";
import styles from "./Layout.module.scss"; import styles from "./Layout.module.scss";
type Props = { const Layout = ({ children }) => (
title?: string;
description?: string;
children: unknown;
};
const Layout = ({ title, description, children }: Props) => (
<> <>
<NextSeo <Header />
title={title}
description={description}
openGraph={{
title: title,
}}
/>
<main className={styles.main}> <main className={styles.main}>
<div className={styles.container}>{children}</div> <div className={styles.container}>{children}</div>
</main> </main>
<Footer />
</> </>
); );

View File

@@ -3,8 +3,7 @@ import { useRouter } from "next/router";
import { ThemeProvider } from "next-themes"; import { ThemeProvider } from "next-themes";
import { DefaultSeo, SocialProfileJsonLd } from "next-seo"; import { DefaultSeo, SocialProfileJsonLd } from "next-seo";
import * as Fathom from "fathom-client"; import * as Fathom from "fathom-client";
import Header from "../components/page-header/Header"; import Layout from "../components/Layout";
import Footer from "../components/page-footer/Footer";
import * as config from "../lib/config"; import * as config from "../lib/config";
import type { AppProps } from "next/app"; import type { AppProps } from "next/app";
@@ -184,9 +183,9 @@ const App = ({ Component, pageProps }: AppProps) => {
/> />
<ThemeProvider> <ThemeProvider>
<Header /> <Layout>
<Component {...pageProps} /> <Component {...pageProps} />
<Footer /> </Layout>
</ThemeProvider> </ThemeProvider>
</> </>
); );

View File

@@ -1,4 +1,4 @@
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import Video from "../components/video/Video"; import Video from "../components/video/Video";
@@ -7,10 +7,15 @@ import { TapeIcon } from "../components/icons";
import thumbnail from "../public/static/images/birthday/thumb.png"; import thumbnail from "../public/static/images/birthday/thumb.png";
const Birthday = () => ( const Birthday = () => (
<Layout <>
<NextSeo
title="🎉 Cranky Birthday Boy on VHS Tape 📼" title="🎉 Cranky Birthday Boy on VHS Tape 📼"
description="The origin of my hatred for the Happy Birthday song." description="The origin of my hatred for the Happy Birthday song."
> openGraph={{
title: "🎉 Cranky Birthday Boy on VHS Tape 📼",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -38,7 +43,7 @@ const Birthday = () => (
controls={true} controls={true}
/> />
</Content> </Content>
</Layout> </>
); );
export default Birthday; export default Birthday;

View File

@@ -1,5 +1,5 @@
import Image from "next/image"; import Image from "next/image";
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import { BotIcon } from "../components/icons"; import { BotIcon } from "../components/icons";
@@ -7,7 +7,15 @@ import { BotIcon } from "../components/icons";
import cliImg from "../public/static/images/cli/screenshot.png"; import cliImg from "../public/static/images/cli/screenshot.png";
const CLI = () => ( const CLI = () => (
<Layout title="CLI" description="AKA, the most useless Node module ever published, in history, by anyone, ever."> <>
<NextSeo
title="CLI"
description="AKA, the most useless Node module ever published, in history, by anyone, ever."
openGraph={{
title: "CLI",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -82,7 +90,7 @@ const CLI = () => (
</a> </a>
</p> </p>
</Content> </Content>
</Layout> </>
); );
export default CLI; export default CLI;

View File

@@ -1,10 +1,18 @@
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import ContactForm from "../components/contact/ContactForm"; import ContactForm from "../components/contact/ContactForm";
import { MailIcon, LockIcon } from "../components/icons"; import { MailIcon, LockIcon } from "../components/icons";
import Content from "../components/Content";
const Contact = () => ( const Contact = () => (
<Layout title="Contact Me"> <>
<NextSeo
title="Contact Me"
openGraph={{
title: "Contact Me",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -12,7 +20,8 @@ const Contact = () => (
</> </>
} }
/> />
<div> <Content>
<div className="wrapper">
<p> <p>
Fill out this quick form and I'll get back to you as soon as I can! You can also{" "} Fill out this quick form and I'll get back to you as soon as I can! You can also{" "}
<a href="mailto:jake@jarv.is">email me directly</a>, send me a{" "} <a href="mailto:jake@jarv.is">email me directly</a>, send me a{" "}
@@ -34,15 +43,15 @@ const Contact = () => (
</p> </p>
<ContactForm /> <ContactForm />
</div> </div>
</Content>
<style jsx>{` <style jsx>{`
div { .wrapper {
max-width: 600px; max-width: 600px;
margin: 0 auto; margin: 0 auto;
font-size: 0.9em;
line-height: 1.7;
} }
code { .wrapper code {
background: none; background: none;
border: 0; border: 0;
padding: 0; padding: 0;
@@ -50,7 +59,7 @@ const Contact = () => (
white-space: normal; white-space: normal;
} }
`}</style> `}</style>
</Layout> </>
); );
export default Contact; export default Contact;

View File

@@ -1,4 +1,4 @@
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import Video from "../components/video/Video"; import Video from "../components/video/Video";
@@ -6,10 +6,15 @@ import Video from "../components/video/Video";
import thumbnail from "../public/static/images/hillary/thumb.png"; import thumbnail from "../public/static/images/hillary/thumb.png";
const Hillary = () => ( const Hillary = () => (
<Layout <>
<NextSeo
title="My Brief Apperance in Hillary Clinton's DNC Video" title="My Brief Apperance in Hillary Clinton's DNC Video"
description="My brief apperance in one of Hillary Clinton's 2016 DNC convention videos on substance abuse." description="My brief apperance in one of Hillary Clinton's 2016 DNC convention videos on substance abuse."
> openGraph={{
title: "My Brief Apperance in Hillary Clinton's DNC Video",
}}
/>
<PageTitle title="My Brief Apperance in Hillary Clinton's DNC Video" /> <PageTitle title="My Brief Apperance in Hillary Clinton's DNC Video" />
<Content> <Content>
<Video <Video
@@ -39,6 +44,7 @@ const Hillary = () => (
}} }}
controls={true} controls={true}
/> />
<p className="copyright"> <p className="copyright">
Video is property of{" "} Video is property of{" "}
<a href="https://www.hillaryclinton.com/" target="_blank" rel="noopener noreferrer"> <a href="https://www.hillaryclinton.com/" target="_blank" rel="noopener noreferrer">
@@ -54,6 +60,8 @@ const Hillary = () => (
</a> </a>
. &copy; 2016. . &copy; 2016.
</p> </p>
</Content>
<style jsx>{` <style jsx>{`
.copyright { .copyright {
text-align: center; text-align: center;
@@ -67,8 +75,7 @@ const Hillary = () => (
font-weight: 700; font-weight: 700;
} }
`}</style> `}</style>
</Content> </>
</Layout>
); );
export default Hillary; export default Hillary;

View File

@@ -1,7 +1,6 @@
import Link from "next/link"; import Link from "next/link";
import isAbsoluteUrl from "is-absolute-url"; import isAbsoluteUrl from "is-absolute-url";
import { colord } from "colord"; import { colord } from "colord";
import Layout from "../components/Layout";
import { WaveIcon, LockIcon } from "../components/icons"; import { WaveIcon, LockIcon } from "../components/icons";
type ColorLinkProps = { type ColorLinkProps = {
@@ -40,7 +39,7 @@ const ColorLink = ({ href, title, lightColor, darkColor, external = false, child
}; };
const Index = () => ( const Index = () => (
<Layout> <>
<h1> <h1>
Hi there! I'm Jake.{" "} Hi there! I'm Jake.{" "}
<span className="wave"> <span className="wave">
@@ -376,7 +375,7 @@ const Index = () => (
} }
} }
`}</style> `}</style>
</Layout> </>
); );
export default Index; export default Index;

View File

@@ -1,4 +1,4 @@
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import Video from "../components/video/Video"; import Video from "../components/video/Video";
@@ -7,10 +7,14 @@ import thumbnail from "../public/static/images/leo/thumb.png";
const Leo = () => ( const Leo = () => (
<> <>
<Layout <NextSeo
title='Facebook App on "The Lab with Leo Laporte"' title='Facebook App on "The Lab with Leo Laporte"'
description="Powncer app featured in Leo Laporte's TechTV show." description="Powncer app featured in Leo Laporte's TechTV show."
> openGraph={{
title: 'Facebook App on "The Lab with Leo Laporte"',
}}
/>
<PageTitle title='Facebook App on "The Lab with Leo Laporte"' /> <PageTitle title='Facebook App on "The Lab with Leo Laporte"' />
<Content> <Content>
<Video <Video
@@ -40,6 +44,7 @@ const Leo = () => (
}} }}
controls={true} controls={true}
/> />
<p className="copyright"> <p className="copyright">
Video is property of{" "} Video is property of{" "}
<a <a
@@ -55,6 +60,8 @@ const Leo = () => (
</a> </a>
. &copy; 2007 G4 Media, Inc. . &copy; 2007 G4 Media, Inc.
</p> </p>
</Content>
<style jsx>{` <style jsx>{`
.copyright { .copyright {
text-align: center; text-align: center;
@@ -68,8 +75,6 @@ const Leo = () => (
font-weight: 700; font-weight: 700;
} }
`}</style> `}</style>
</Content>
</Layout>
</> </>
); );

View File

@@ -1,10 +1,17 @@
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import { LicenseIcon } from "../components/icons"; import { LicenseIcon } from "../components/icons";
const License = () => ( const License = () => (
<Layout title="License"> <>
<NextSeo
title="License"
openGraph={{
title: "License",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -459,7 +466,7 @@ const License = () => (
</p> </p>
</blockquote> </blockquote>
</Content> </Content>
</Layout> </>
); );
export default License; export default License;

View File

@@ -1,7 +1,6 @@
import { MDXRemote } from "next-mdx-remote"; import { MDXRemote } from "next-mdx-remote";
import { serialize } from "next-mdx-remote/serialize"; import { serialize } from "next-mdx-remote/serialize";
import { NextSeo, ArticleJsonLd } from "next-seo"; import { NextSeo, ArticleJsonLd } from "next-seo";
import Layout from "../../components/Layout";
import Content from "../../components/Content"; import Content from "../../components/Content";
import Meta from "../../components/notes/Meta"; import Meta from "../../components/notes/Meta";
import mdxComponents from "../../components/mdxComponents"; import mdxComponents from "../../components/mdxComponents";
@@ -53,14 +52,12 @@ const Note = ({ frontMatter, source }) => (
publisherLogo={`${config.baseUrl}/static/images/me.jpg`} publisherLogo={`${config.baseUrl}/static/images/me.jpg`}
/> />
<Layout>
<Meta {...frontMatter} /> <Meta {...frontMatter} />
<Content> <Content>
<div className="markdown"> <div className="markdown">
<MDXRemote {...source} components={mdxComponents} /> <MDXRemote {...source} components={mdxComponents} />
</div> </div>
</Content> </Content>
</Layout>
</> </>
); );

View File

@@ -1,13 +1,21 @@
import { NextSeo } from "next-seo";
import { format } from "date-fns"; import { format } from "date-fns";
import Layout from "../../components/Layout";
import List from "../../components/notes/List"; import List from "../../components/notes/List";
import { getAllNotes } from "../../lib/parse-notes"; import { getAllNotes } from "../../lib/parse-notes";
import type { GetStaticProps } from "next"; import type { GetStaticProps } from "next";
const Notes = ({ notesByYear }) => ( const Notes = ({ notesByYear }) => (
<Layout title="Notes" description="Recent posts by Jake Jarvis."> <>
<NextSeo
title="Notes"
description="Recent posts by Jake Jarvis."
openGraph={{
title: "Notes",
}}
/>
<List notesByYear={notesByYear} /> <List notesByYear={notesByYear} />
</Layout> </>
); );
export const getStaticProps: GetStaticProps = async () => { export const getStaticProps: GetStaticProps = async () => {

View File

@@ -1,7 +1,7 @@
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import Image from "next/image"; import Image from "next/image";
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import { FloppyIcon, SirenIcon } from "../components/icons"; import { FloppyIcon, SirenIcon } from "../components/icons";
@@ -22,10 +22,14 @@ import img_2018_04 from "../public/static/images/previously/2018_04.png";
const Previously = () => ( const Previously = () => (
<> <>
<Layout <NextSeo
title="Previously on..." title="Previously on..."
description="An incredibly embarrassing and somewhat painful down of this site's memory lane..." description="An incredibly embarrassing and somewhat painful down of this site's memory lane..."
> openGraph={{
title: "Previously on...",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -197,7 +201,7 @@ const Previously = () => (
</figcaption> </figcaption>
</figure> </figure>
</Content> </Content>
</Layout>
<style jsx global>{` <style jsx global>{`
body { body {
font-family: "Comic Neue", "Comic Sans MS", "Comic Sans", "Inter", sans-serif; font-family: "Comic Neue", "Comic Sans MS", "Comic Sans", "Inter", sans-serif;

View File

@@ -1,6 +1,6 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import { PrivacyIcon } from "../components/icons"; import { PrivacyIcon } from "../components/icons";
@@ -8,7 +8,14 @@ import { PrivacyIcon } from "../components/icons";
import faunaImg from "../public/static/images/privacy/fauna_hits.png"; import faunaImg from "../public/static/images/privacy/fauna_hits.png";
const Privacy = () => ( const Privacy = () => (
<Layout title="Privacy"> <>
<NextSeo
title="Privacy"
openGraph={{
title: "Privacy",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -211,7 +218,7 @@ const Privacy = () => (
, for what it's worth. (A few cents, probably... 💰) , for what it's worth. (A few cents, probably... 💰)
</p> </p>
</Content> </Content>
</Layout> </>
); );
export default Privacy; export default Privacy;

View File

@@ -1,12 +1,19 @@
import { graphql } from "@octokit/graphql"; import { graphql } from "@octokit/graphql";
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import RepoCard from "../components/projects/RepoCard"; import RepoCard from "../components/projects/RepoCard";
import { ProjectsIcon } from "../components/icons"; import { ProjectsIcon } from "../components/icons";
import type { GetStaticProps } from "next"; import type { GetStaticProps } from "next";
const Projects = ({ repos }) => ( const Projects = ({ repos }) => (
<Layout title="Projects"> <>
<NextSeo
title="Projects"
openGraph={{
title: "Projects",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -43,6 +50,7 @@ const Projects = ({ repos }) => (
<a href="https://github.com/jakejarvis?tab=repositories" target="_blank" rel="noopener noreferrer"> <a href="https://github.com/jakejarvis?tab=repositories" target="_blank" rel="noopener noreferrer">
View more on GitHub... View more on GitHub...
</a> </a>
<style jsx>{` <style jsx>{`
p { p {
text-align: center; text-align: center;
@@ -50,7 +58,7 @@ const Projects = ({ repos }) => (
} }
`}</style> `}</style>
</p> </p>
</Layout> </>
); );
export const getStaticProps: GetStaticProps = async () => { export const getStaticProps: GetStaticProps = async () => {

View File

@@ -1,6 +1,6 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import Layout from "../components/Layout"; import { NextSeo } from "next-seo";
import Content from "../components/Content"; import Content from "../components/Content";
import PageTitle from "../components/page/PageTitle"; import PageTitle from "../components/page/PageTitle";
import { LaptopIcon } from "../components/icons"; import { LaptopIcon } from "../components/icons";
@@ -8,7 +8,15 @@ import { LaptopIcon } from "../components/icons";
import desktopImg from "../public/static/images/uses/bigsur.png"; import desktopImg from "../public/static/images/uses/bigsur.png";
const Uses = () => ( const Uses = () => (
<Layout title="/uses" description="Things I use daily."> <>
<NextSeo
title="/uses"
description="Things I use daily."
openGraph={{
title: "/uses",
}}
/>
<PageTitle <PageTitle
title={ title={
<> <>
@@ -1070,7 +1078,7 @@ const Uses = () => (
</li> </li>
</ul> </ul>
</Content> </Content>
</Layout> </>
); );
export default Uses; export default Uses;