Skip to content

Commit

Permalink
learn route structure setup completed, made sidebar functional
Browse files Browse the repository at this point in the history
  • Loading branch information
aayank13 committed Nov 6, 2024
1 parent 116493f commit 8a96131
Show file tree
Hide file tree
Showing 11 changed files with 483 additions and 430 deletions.
15 changes: 8 additions & 7 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { ThemeProvider } from "@/context/ThemeContext";

export const metadata: Metadata = {
title: "ML4E - Machine Learning for Everyone",
description: "ML4E - Machine Learning for Everyone is a collection of resources to help you learn machine learning.",
description:
"ML4E - Machine Learning for Everyone is a collection of resources to help you learn machine learning.",
};

export default function RootLayout({
Expand All @@ -14,11 +15,11 @@ export default function RootLayout({
}>) {
return (
<html lang="en">
<body>
<ThemeProvider>
{children}
</ThemeProvider>
</body>
<body>
<ThemeProvider>
{children}
</ThemeProvider>
</body>
</html>
);
);
}
20 changes: 20 additions & 0 deletions app/learn/[category]/[subcategory]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { contentData, ContentItem } from "@/data/content";

export default async function LearnPage({ params }: { params: { category: string; subcategory: string } }) {
// Wait for params to be available
const { category, subcategory } = await Promise.resolve(params); // Ensures params are handled asynchronously

// Safely access content based on params
const content: ContentItem | undefined = contentData[category]?.items?.[subcategory];

if (!content) {
return <div>Content not found</div>;
}

return (
<div className="p-6">
<h1 className="text-2xl font-bold mb-4">{content.title}</h1>
<p>{content.content}</p>
</div>
);
}
30 changes: 17 additions & 13 deletions app/learn/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import React from 'react';
import { Metadata } from 'next';
import { SidebarProvider } from "@/components/ui/sidebar"
import React from "react";
import { Metadata } from "next";
import { SidebarProvider, SidebarTrigger } from "@/components/ui/sidebar";
import AppSidebar from "@/components/custom/AppSidebar";
// import LearnNavbar from "@/components/custom/LearnNavbar";

export const metadata: Metadata = {
title: "Learn - ML4E",
description: "ML4E - Machine Learning for Everyone is a collection of resources to help you learn machine learning.",
title: "Learn - ML4E",
description: "ML4E - Machine Learning for Everyone is a collection of resources to help you learn machine learning.",
};

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<SidebarProvider>
return (
<SidebarProvider>
<div className="flex h-screen overflow-hidden">
<AppSidebar />
<main>
<div className="flex-1 overflow-auto p-4">
<SidebarTrigger />
{/* <LearnNavbar /> */}
{children}
</main>
</SidebarProvider>
)
}
</div>
</div>
</SidebarProvider>
);
}
6 changes: 3 additions & 3 deletions app/learn/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'

const page = () => {
const Learn = () => {
return (
<div></div>
<div>hello</div>
)
}

export default page
export default Learn
Loading

0 comments on commit 8a96131

Please sign in to comment.