2024-09-07 10:18:21 +01:00
|
|
|
<script lang="ts">
|
2025-11-01 15:49:29 +01:00
|
|
|
import CircleCheckIcon from '@lucide/svelte/icons/circle-check';
|
|
|
|
|
import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';
|
|
|
|
|
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
2024-09-09 01:14:55 +01:00
|
|
|
import pluralize from 'pluralize';
|
2024-09-07 10:18:21 +01:00
|
|
|
|
|
|
|
|
import { t } from '$lib/utils/functions/translations';
|
|
|
|
|
import type { Lesson } from '$lib/utils/types';
|
|
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
interface Props {
|
|
|
|
|
title: string;
|
|
|
|
|
lessonCount: number;
|
|
|
|
|
exerciseCount: number;
|
|
|
|
|
lessons: Lesson[];
|
|
|
|
|
}
|
2024-09-07 10:18:21 +01:00
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
let { title, lessonCount, exerciseCount, lessons }: Props = $props();
|
|
|
|
|
|
|
|
|
|
let expand = $state(false);
|
2024-09-07 10:18:21 +01:00
|
|
|
</script>
|
|
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
<div class="my-3 w-full rounded-md">
|
2024-09-07 10:18:21 +01:00
|
|
|
<!-- lesson header -->
|
2024-09-09 01:14:55 +01:00
|
|
|
<button
|
2025-11-01 15:49:29 +01:00
|
|
|
class="flex w-full items-center justify-between bg-[#F7F7F7] py-3 pl-3 pr-4 text-sm font-medium dark:bg-neutral-700"
|
|
|
|
|
onclick={() => (expand = !expand)}
|
2024-09-09 01:14:55 +01:00
|
|
|
>
|
2024-09-07 10:18:21 +01:00
|
|
|
<span class="flex items-center gap-2">
|
2024-09-09 01:14:55 +01:00
|
|
|
{#if expand}
|
2025-11-01 15:49:29 +01:00
|
|
|
<ChevronUpIcon size={16} />
|
2024-09-09 01:14:55 +01:00
|
|
|
{:else}
|
2025-11-01 15:49:29 +01:00
|
|
|
<ChevronDownIcon size={16} />
|
2024-09-09 01:14:55 +01:00
|
|
|
{/if}
|
|
|
|
|
{title}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="text-xs font-normal">
|
|
|
|
|
{pluralize($t('course.navItem.landing_page.lessons'), lessonCount, true)},
|
|
|
|
|
{pluralize($t('course.navItem.landing_page.exercises'), exerciseCount, true)}
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
2024-09-07 10:18:21 +01:00
|
|
|
|
2024-09-09 01:14:55 +01:00
|
|
|
{#if expand}
|
2025-12-22 02:36:48 +01:00
|
|
|
{#each lessons as lesson (lesson.id)}
|
2025-11-01 15:49:29 +01:00
|
|
|
<div class="lesson-section flex items-center gap-2 py-3 pl-3 text-[13px] text-[#656565]">
|
|
|
|
|
<CircleCheckIcon size={16} />
|
2024-09-07 10:18:21 +01:00
|
|
|
{lesson.title}
|
|
|
|
|
</div>
|
|
|
|
|
{/each}
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|