Files
classroomio/src/lib/components/Courses/index.svelte
T

53 lines
1.7 KiB
Svelte
Raw Normal View History

2023-09-10 07:24:06 +01:00
<script lang="ts">
2021-08-29 07:23:19 +03:00
import Box from '../Box/index.svelte';
import Card from './components/Card/index.svelte';
import CardLoader from './components/Card/Loader.svelte';
import CoursesEmptyIcon from '../Icons/CoursesEmptyIcon.svelte';
2021-12-30 22:30:30 +02:00
import CopyCourseModal from './components/CopyCourseModal/index.svelte';
import { courses, courseMetaDeta } from './store';
2021-05-06 08:22:25 +03:00
</script>
2021-12-30 22:30:30 +02:00
<CopyCourseModal />
<div
class={`w-full ${$courseMetaDeta.isLoading || $courses ? 'cards-container' : ''} my-4 mx-auto`}
>
2021-12-30 22:30:30 +02:00
{#if $courseMetaDeta.isLoading}
<CardLoader />
<CardLoader />
<CardLoader />
2021-12-30 22:30:30 +02:00
{:else}
{#each $courses as courseData}
<Card
id={courseData.id}
logo={courseData.logo}
bannerImage={courseData.banner_image}
2021-12-30 22:30:30 +02:00
title={courseData.title}
description={courseData.description}
role_id={courseData.role_id}
isPublished={courseData.is_published}
cost={courseData.cost}
currency={courseData.currency}
totalLessons={courseData.total_lessons}
2021-12-30 22:30:30 +02:00
/>
<!-- {:else}
<Box className="w-full">
<CoursesEmptyIcon />
<h3 class="dark:text-white text-2xl my-5">No Courses Created</h3>
<p class="dark:text-white w-1/3 text-center">
Share your knowledge with the world by creating engaging courses for your students.
</p>
</Box> -->
2021-12-30 22:30:30 +02:00
{/each}
{/if}
2021-05-07 03:43:37 +03:00
</div>
{#if !$courses.length}
<Box className="w-full">
<CoursesEmptyIcon />
<h3 class="dark:text-white text-2xl my-5">No Courses Created</h3>
<p class="dark:text-white w-1/3 text-center">
Share your knowledge with the world by creating engaging courses for your students.
</p>
</Box>
{/if}