瀏覽代碼

feat: tighten the page bottom and give the footer its links

The last row of cards sat 112px (phone) or 64px (desktop) above a lone
line of text, with nothing under the Writing card. The footer now sits
one step below the page (24px on phones, 36px from 640px up), spans the
page's own column with its text on the column's text edge (the cards'
padding at home, the list on the blog, the prose in a post), and carries
GitHub, LinkedIn and Email on the right. On phones it ends just clear of
the floating nav instead of 112px below it, and on short pages such as
the 404 it stays at the bottom of the window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QEPoSHwHCYMNpm2iKxY9hL
Claude 1 月之前
父節點
當前提交
de323bafa3
共有 7 個文件被更改,包括 78 次插入 和 18 次删除
  1. 5 1
      app/blog/layout.tsx
  2. 1 1
      app/layout.tsx
  3. 1 1
      app/not-found.tsx
  4. 1 1
      components/blog/blog-list.tsx
  5. 1 1
      components/blog/notion-page.tsx
  6. 41 12
      components/site-footer.tsx
  7. 28 1
      styles/globals.css

+ 5 - 1
app/blog/layout.tsx

@@ -3,5 +3,9 @@ export default function BlogLayout({
 }: {
   children: React.ReactNode;
 }) {
-  return <div className="mx-auto w-full max-w-[1040px]">{children}</div>;
+  return (
+    <div className="mx-auto w-full max-w-[1040px]" data-col="blog">
+      {children}
+    </div>
+  );
 }

+ 1 - 1
app/layout.tsx

@@ -138,7 +138,7 @@ export default function RootLayout({
           <Backdrop />
           <SiteNav />
           <main
-            className="relative z-10 mx-auto w-full max-w-[1240px] px-3 pt-6 pb-28 sm:px-6 sm:pt-24 sm:pb-16"
+            className="relative z-10 mx-auto w-full max-w-[1240px] grow px-3 pt-6 pb-6 sm:px-6 sm:pt-24 sm:pb-9"
             id="main"
           >
             {children}

+ 1 - 1
app/not-found.tsx

@@ -7,7 +7,7 @@ export default function NotFound() {
       <h1 className="font-display text-[clamp(4rem,14vw,8rem)] leading-none font-semibold tracking-[-0.03em]">
         Lost<span className="text-glacier">.</span>
       </h1>
-      <p className="max-w-[40ch] text-[15px] text-ink-2">
+      <p className="max-w-[40ch] text-[15px] text-pretty text-ink-2">
         This trail doesn&apos;t exist. Even Bert couldn&apos;t sniff it out.
       </p>
       <Link

+ 1 - 1
components/blog/blog-list.tsx

@@ -18,7 +18,7 @@ const fmt = (d: Date | null) =>
 
 export function BlogList({ blogPosts }: { blogPosts: Post[] }) {
   return (
-    <div className="pb-6">
+    <div>
       <header className="mb-8 flex flex-col items-start gap-3 pt-2 sm:mb-10">
         <Eyebrow>Writing · {blogPosts.length} posts</Eyebrow>
         <h1 className="font-display text-[clamp(2.3rem,5.2vw,3.6rem)] leading-[1.02] font-semibold tracking-[-0.02em]">

+ 1 - 1
components/blog/notion-page.tsx

@@ -135,7 +135,7 @@ export const NotionPage = ({
   const created = getBlockValue(recordMap.block[rootPageId])?.created_time;
 
   return (
-    <article ref={articleRef} className="mx-auto max-w-[760px]">
+    <article ref={articleRef} className="mx-auto max-w-[760px]" data-col="post">
       {/* Header and back link line up with the Notion body (its page padding plus the text's 2px). */}
       <Link
         className="lg ml-[calc(min(16px,8vw)_+_2px)] inline-flex h-9 items-center gap-1.5 rounded-full px-3.5 text-[13px] font-medium"

+ 41 - 12
components/site-footer.tsx

@@ -1,20 +1,49 @@
 import { Shortcut } from "@/components/nav/shortcut";
 import { siteConfig } from "@/config/site";
 
+const links = [
+  { label: "GitHub", href: siteConfig.links.github },
+  { label: "LinkedIn", href: siteConfig.links.linkedin },
+  { label: "Email", href: siteConfig.links.email },
+];
+
+/**
+ * One step below the page, spanning its column with the text on the column's
+ * text edge (see .site-footer). On phones it ends just clear of the floating nav.
+ */
 export function SiteFooter() {
   return (
-    <footer className="relative z-10 mx-auto flex w-full max-w-[1240px] flex-col gap-2 px-4 pb-28 text-[12.5px] text-muted sm:flex-row sm:items-center sm:justify-between sm:px-6 sm:pb-10">
-      <p>
-        © {new Date().getFullYear()} {siteConfig.author} · Seattle, WA
-        <span className="max-sm:hidden">
-          {" "}
-          ·{" "}
-          <kbd className="rounded-md border border-line px-1.5 py-0.5 font-sans text-[11px]">
-            <Shortcut />
-          </kbd>{" "}
-          to explore
-        </span>
-      </p>
+    <footer className="site-footer relative z-10 mx-auto w-full max-w-[1240px] px-3 pb-[calc(max(14px,env(safe-area-inset-bottom))+72px)] sm:px-6 sm:pb-9">
+      <div className="mx-auto flex max-w-(--footer-col) flex-col gap-2.5 px-(--footer-inset) text-[12.5px] text-muted min-[480px]:flex-row min-[480px]:items-center min-[480px]:justify-between">
+        <p>
+          © {new Date().getFullYear()} {siteConfig.author} ·{" "}
+          {siteConfig.location}
+          <span className="max-sm:hidden">
+            {" "}
+            ·{" "}
+            <kbd className="rounded-md border border-line px-1.5 py-0.5 font-sans text-[11px]">
+              <Shortcut />
+            </kbd>{" "}
+            to explore
+          </span>
+        </p>
+        <ul className="flex items-center gap-5">
+          {links.map((l) => (
+            <li key={l.label}>
+              {/* Padding cancelled by margin: a bigger tap target, same layout. */}
+              <a
+                className="-mx-1.5 -my-2 inline-block px-1.5 py-2 transition-colors hover:text-ink"
+                data-cursor={l.label}
+                href={l.href}
+                rel="noopener noreferrer"
+                target={l.href.startsWith("http") ? "_blank" : undefined}
+              >
+                {l.label}
+              </a>
+            </li>
+          ))}
+        </ul>
+      </div>
     </footer>
   );
 }

+ 28 - 1
styles/globals.css

@@ -306,7 +306,10 @@ html.ff {
     color-scheme: dark;
   }
 
+  /* A column, so on short pages the footer still sits at the bottom. */
   body {
+    display: flex;
+    flex-direction: column;
     min-height: 100dvh;
     background: var(--bg);
     color: var(--ink);
@@ -771,6 +774,30 @@ html.ff {
       inset 0 -8px 16px -10px rgb(255 255 255 / 0.12),
       inset 0 0 0 0.5px rgb(255 255 255 / 0.1);
   }
+
+  /* The footer spans the page's column, its text on the column's text edge:
+     the cards' padding on the home grid, the header on the blog, the prose in
+     a post. */
+  .site-footer {
+    --footer-col: 100%;
+    --footer-inset: 20px;
+  }
+
+  @media (min-width: 640px) {
+    .site-footer {
+      --footer-inset: 24px;
+    }
+  }
+
+  html:has([data-col="blog"]) .site-footer {
+    --footer-col: 1040px;
+    --footer-inset: 0px;
+  }
+
+  html:has([data-col="post"]) .site-footer {
+    --footer-col: 760px;
+    --footer-inset: calc(min(16px, 8vw) + 2px);
+  }
 }
 
 /* ---------- Motion ---------- */
@@ -926,7 +953,7 @@ html .notion-title {
 }
 
 html .notion-page {
-  padding-bottom: 6rem;
+  padding-bottom: 1.5rem;
 }
 
 html .notion-text,