Menu
Coddy logo textTech

Step 2: The Menu Grid

Part of the Next.js Essentials section of Coddy's React journey — lesson 40 of 47.

challenge icon

Challenge

Easy

Fill the menu in app/page.jsx.

  1. Make Home async and await getDishes() from ../lib/menu.js.
  2. Keep the hero, and after it render a <ul className="grid"> with one <li className="card"> per dish (key = the slug).
  3. Each card holds a <div className="thumb"> with id={'thumb-' + dish.slug}, the dish's emoji as its content, and style={{ background: dish.gradient }}.
  4. Then a <div className="card-body"> containing an <h2 className="card-title"> with id={'name-' + dish.slug} and the name, a <p className="card-desc"> with the description, and a <span className="price"> with id={'price-' + dish.slug} reading $ then the price.

Try it yourself

import Link from 'next/link';
import './globals.css';

export const metadata = {
    title: {
        default: 'Coddy Eats',
        template: '%s | Coddy Eats',
    },
};

export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <body>
                <nav className="nav">
                    <Link className="brand" href="/">Coddy Eats</Link>
                    <Link id="nav-menu" href="/">Menu</Link>
                    <Link id="nav-desserts" href="/?category=dessert">Desserts</Link>
                </nav>
                <div className="container">
                    {children}
                </div>
            </body>
        </html>
    );
}

All lessons in Next.js Essentials