Skip to content

Checkpoint: A Study Club Site

The Course
•
20 min study

Close the earlier lessons and build this from the brief.

The brief

A site for a Study Club, with three pages:

RouteHeadingContent
/Study ClubWe learn together. See the schedule., where schedule links to /schedule
/scheduleScheduleA list: Week 1: Pages and routes, Week 2: Server and client components
/membersMembersA list: Ada, Grace, Linus

On every page:

  • a navigation bar with Home, Schedule and Members links, at the top;
  • a footer, Study Club meets every Thursday., at the bottom.

Also:

  • The home page's heading has its own colour, from a CSS Module.
  • An unknown address shows No such page with a link back home, and still has the navigation and footer.

Acceptance checks: follow every link, use the back button, and try /nope.

Your workspace Next.js · 3 files
import "./globals.css"; export default function RootLayout({ children }) { return ( <html lang="en"> <body> {children} </body> </html> ); } // Build the Study Club site here. See the brief. export default function HomePage() { return ( <main> <h1>Study Club</h1> </main> ); } body { font: 16px/1.5 system-ui, sans-serif; margin: 0; color: #1c2430; } header, main, footer { max-width: 36rem; margin: 0 auto; padding: 0.75rem 1rem; } header { border-bottom: 1px solid #d6dde6; } nav { display: flex; gap: 1rem; } a { color: #06617f; } h1 { margin: 0.5rem 0; } .muted { color: #5b6876; } .card { border: 1px solid #d6dde6; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
Runs with real Next.js on your computer: unzip, then npm install and npm run dev.
Add and remove files here; write their code in the editor.
Hint 1: the files

app/schedule/page.jsx, app/members/page.jsx, app/not-found.jsx and app/page.module.css, plus changes to app/layout.jsx and app/page.jsx.

Hint 2: on every page

The navigation and footer go in the root layout, around {children}.

Show one solution
One solution Next.js · 7 files
import Link from "next/link"; import "./globals.css"; export default function RootLayout({ children }) { return ( <html lang="en"> <body> <header> <nav> <Link href="/">Home</Link> <Link href="/schedule">Schedule</Link> <Link href="/members">Members</Link> </nav> </header> {children} <footer className="muted">Study Club meets every Thursday.</footer> </body> </html> ); } import Link from "next/link"; import styles from "./page.module.css"; export default function HomePage() { return ( <main> <h1 className={styles.title}>Study Club</h1> <p> We learn together. See the <Link href="/schedule">schedule</Link>. </p> </main> ); } .title { color: #06617f; } import Link from "next/link"; export default function NotFound() { return ( <main> <h1>No such page</h1> <p> Go back to the <Link href="/">Study Club home page</Link>. </p> </main> ); } body { font: 16px/1.5 system-ui, sans-serif; margin: 0; color: #1c2430; } header, main, footer { max-width: 36rem; margin: 0 auto; padding: 0.75rem 1rem; } header { border-bottom: 1px solid #d6dde6; } nav { display: flex; gap: 1rem; } a { color: #06617f; } h1 { margin: 0.5rem 0; } .muted { color: #5b6876; } .card { border: 1px solid #d6dde6; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; } export default function MembersPage() { return ( <main> <h1>Members</h1> <ul> <li>Ada</li> <li>Grace</li> <li>Linus</li> </ul> </main> ); } export default function SchedulePage() { return ( <main> <h1>Schedule</h1> <ul> <li>Week 1: Pages and routes</li> <li>Week 2: Server and client components</li> </ul> </main> ); }
Runs with real Next.js on your computer: unzip, then npm install and npm run dev.
Add and remove files here; write their code in the editor.

Check yourself

  1. Which file makes the page at /members?
  2. What does a layout receive as children, and what stays on screen when you follow a link?
  3. Why use Link instead of <a> for your own pages?

Was this article helpful?

Your response is saved on this device.