Skip to content

Commit c3dea80

Browse files
author
Alex Patterson
authored
Merge pull request CodingCatDev#131 from CodingCatDev/feature/lessons-added-postlayout
add back course sections
2 parents a02bdae + faedc65 commit c3dea80

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

frontend/main/src/components/PostLayout.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,46 @@ export default function PostLayout({
167167
</section>
168168

169169
<section className="grid grid-cols-1 gap-4 p-10 2xl:grid-cols-sidebar 2xl:pl-10">
170+
{/* LESSONS */}
171+
{course && course.sections && (
172+
<section className="grid content-start grid-cols-1 row-start-2 gap-4 2xl:col-start-2 2xl:row-start-1">
173+
{course.sections.map((section) => (
174+
<section
175+
key={section.id}
176+
className="flex flex-col bg-basics-50 rounded-t-md"
177+
>
178+
<h2 className="p-2 m-0 text-2xl font-bold xl:p-4 rounded-t-md xl:flex-shrink-0 bg-secondary-600 dark:bg-secondary-600 text-basics-50 dark:text-basics-50">
179+
{section.title}
180+
</h2>
181+
<ul className="flex flex-col flex-grow justify-items-stretch">
182+
{section.lessons &&
183+
section.lessons.map((lesson) => (
184+
<li key={lesson.id} className="ml-0 list-none">
185+
<Link
186+
href={`/course/${course.slug}/lesson/${lesson.slug}`}
187+
key={lesson.id}
188+
>
189+
<div
190+
className={`p-2 cursor-pointer
191+
${
192+
isActiveLink(course, lesson)
193+
? 'bg-primary-200'
194+
: 'bg-transparent'
195+
}
196+
`}
197+
>
198+
<a className="no-underline text-basics-900 hover:text-primary-900 hover:underline">
199+
{lesson.title}
200+
</a>
201+
</div>
202+
</Link>
203+
</li>
204+
))}
205+
</ul>
206+
</section>
207+
))}
208+
</section>
209+
)}
170210
{/* RECENTS */}
171211
{recentPosts && (
172212
<section className="grid content-start grid-cols-1 row-start-2 gap-4 2xl:col-start-2 2xl:row-start-1">

0 commit comments

Comments
 (0)