Create a simple recipe browsing application using Next.js that demonstrates your understanding of core Next.js concepts. The app should have the following features:
-
Home Page (
/app/page.js
)- Display a grid of recipe cards
- Each card should show:
- Recipe name
- Cooking time
- Difficulty level
- A "View Details" button
-
Recipe Detail Page (
/app/recipes/[id]/page.js
)- Show detailed information about the selected recipe
- Include:
- Recipe name
- Cooking time
- Difficulty level
- Ingredients list
- Cooking instructions
- "Back to Home" button
-
Search Component (
/app/components/Search.js
)- Create a search bar that filters recipes by name
- Should update results in real-time as the user types
-
Filter Component (
/app/components/Filter.js
)- Add difficulty level filters (Easy, Medium, Hard)
- Allow multiple selections
// /app/data/recipes.js
export const recipes = [
{
id: 1,
name: "Classic Margherita Pizza",
cookingTime: "30 minutes",
difficulty: "Easy",
ingredients: [
"Pizza dough",
"Tomato sauce",
"Fresh mozzarella",
"Fresh basil",
"Olive oil"
],
instructions: [
"Preheat oven to 450°F",
"Roll out the pizza dough",
"Spread tomato sauce",
"Add mozzarella",
"Bake for 15-20 minutes",
"Top with fresh basil"
]
},
{
id: 2,
name: "Beef Stir Fry",
cookingTime: "25 minutes",
difficulty: "Medium",
ingredients: [
"Beef strips",
"Mixed vegetables",
"Soy sauce",
"Garlic",
"Ginger"
],
instructions: [
"Marinate beef in soy sauce",
"Heat wok until very hot",
"Stir-fry beef until browned",
"Add vegetables",
"Cook until tender"
]
}
]
- Use Next.js 14 with App Router
- Implement client-side search and filtering using React hooks
- Create reusable components
- Use proper TypeScript types (optional but preferred)
- Implement proper error handling for non-existent recipes
- Add loading states
- Make the UI responsive using Tailwind CSS
-
Code Organization
- Proper file structure
- Component reusability
- Clean code practices
-
Next.js Understanding
- Correct usage of App Router
- Proper implementation of dynamic routes
- Effective use of client and server components
-
React Knowledge
- Proper state management
- Effective use of hooks
- Component composition
-
UI/UX
- Responsive design
- Loading states
- Error handling
- User-friendly interface
-
Performance
- Efficient filtering and search implementation
- Proper use of client vs server components
- No unnecessary re-renders