An Interest In:
Web News this Week
- March 22, 2024
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
Creating the work page - part 9
What would our portfolio be without a dedicated work page, right?
Let's get started on creating this. Hopefully, we can reuse some of the components we already created when working on the homepage, as we see for the blog page.
As a reminder, the work page looks like this in the design file.
Creating the work page
Let's start by adding a new page to our pages directory. We'll call this file work.js
.
The rough outline for it will look like this:
import Head from 'next/head';export default function WorkPage() { return ( <div> <Head> <title>NextJS Work</title> <meta name='description' content='Generated by create next app' /> <link rel='icon' href='/favicon.ico' /> </Head> <section> <div> <h1>Work</h1> </div> </section> </div> );}
We can reuse all the classes we used in yesterday's blog page.
<section className="px-6"> <div className="max-w-4xl mx-auto"> <h1 className="text-3xl font-bold mb-6 p-4">Work</h1> </div></section>
Now let's add some mockup work components we created before.
import Head from 'next/head';import Work from '../components/work';export default function WorkPage() { return ( <div> <Head> <title>NextJS Work</title> <meta name='description' content='Generated by create next app' /> <link rel='icon' href='/favicon.ico' /> </Head> <section className='px-6'> <div className='max-w-4xl mx-auto'> <h1 className='text-3xl font-bold mb-6 p-4'>Work</h1> <Work /> <Work /> <Work /> <Work /> </div> </section> </div> );}
Let's see how it looks when we run our app and visit the work page.
Wow, this one works out of the box. Thank you, reusable components.
You can also find the completed code for today on GitHub
Thank you for reading, and let's connect!
Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter
Original Link: https://dev.to/dailydevtips1/creating-the-work-page-part-9-540m
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To