Sure! Below is a basic example of how you can design a "Explore Our 100% Subsidized HRDCorp Claimable Courses" section along with a sidebar using Next.js and Tailwind CSS.
Step 1: Setup Next.js Project
First, you need to set up a Next.js project if you haven't already:
bash Copy code
npx create-next-app@latest my-next-app
cd my-next-app
Step 2: Install Tailwind CSS
Follow the official Tailwind CSS installation guide for Next.js:
bash Copy code
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Then, configure your tailwind.config.js:
js Copy code
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Add the Tailwind directives to your styles/globals.css file:
css Copy code
@tailwind base;
@tailwind components;
@tailwind utilities;
Step 3: Create the Course Card Component
Create a new component CourseCard.js in the components directory:
jsx Copy code
// components/CourseCard.js
export default function CourseCard({ title, description }) {
return (
<div className="max-w-sm rounded overflow-hidden shadow-lg bg-white m-4">
<div className="px-6 py-4">
<div className="font-bold text-xl mb-2">{title}</div>
<p className="text-gray-700 text-base">{description}</p>
</div>
<div className="px-6 pt-4 pb-2">
<span className="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">HRDCorp Claimable</span>
</div>
</div>
);
}
Step 4: Create the Sidebar Component
Create a new component Sidebar.js in the components directory:
jsx Copy code
// components/Sidebar.js
export default function Sidebar() {
return (
<div className="w-64 bg-gray-800 text-white p-4">
<h2 className="text-xl font-bold mb-4">Categories</h2>
<ul>
<li className="mb-2"><a href="#" className="hover:bg-gray-700 p-2 block">Category 1</a></li>
<li className="mb-2"><a href="#" className="hover:bg-gray-700 p-2 block">Category 2</a></li>
<li className="mb-2"><a href="#" className="hover:bg-gray-700 p-2 block">Category 3</a></li>
</ul>
</div>
);
}
Step 5: Create the Main Page
Edit your pages/index.js to include the sidebar and course cards:
jsx Copy code
// pages/index.js
import Sidebar from '../components/Sidebar';
import CourseCard from '../components/CourseCard';
export default function Home() {
const courses = [
{ title: 'Course 1', description: 'Description for Course 1' },
{ title: 'Course 2', description: 'Description for Course 2' },
{ title: 'Course 3', description: 'Description for Course 3' },
// Add more courses as needed
];
return (
<div className="flex">
<Sidebar />
<div className="flex-1 p-6">
<h1 className="text-3xl font-bold mb-6">Explore Our 100% Subsidized HRDCorp Claimable Courses</h1>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{courses.map((course, index) => (
<CourseCard key={index} title={course.title} description={course.description} />
))}
</div>
</div>
</div>
);
}
Step 6: Run Your Project
Run your Next.js project:
Navigate to http://localhost:3000 to see your new "Explore Our 100% Subsidized HRDCorp Claimable Courses" section with a sidebar.
This is a basic example to get you started. You can further customize the styles, add more functionality, and enhance the components as needed.