From 7d7d68594bcd37f5294d875334697c722d745ffe Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Mon, 3 Jan 2022 20:28:35 +0200 Subject: [PATCH] CLASSROOMIO-T-32: Landing page with editor v1 --- .../Navigation/NavExpandable.svelte | 66 ++++++ .../Course/components/Navigation/index.svelte | 6 +- .../components/Editor/Container.svelte | 74 +++++++ .../components/Editor/index.svelte | 38 ++++ src/components/CourseLandingPage/index.svelte | 207 ++++++++++++++++++ src/components/Expandable/index.svelte | 89 ++++---- src/components/MarkdownRender/index.svelte | 13 +- src/components/Tailwindcss.svelte | 1 + src/routes/_layout.svelte | 2 +- src/routes/course/[slug].svelte | 34 +++ 10 files changed, 476 insertions(+), 54 deletions(-) create mode 100644 src/components/Course/components/Navigation/NavExpandable.svelte create mode 100644 src/components/CourseLandingPage/components/Editor/Container.svelte create mode 100644 src/components/CourseLandingPage/components/Editor/index.svelte create mode 100644 src/components/CourseLandingPage/index.svelte create mode 100644 src/routes/course/[slug].svelte diff --git a/src/components/Course/components/Navigation/NavExpandable.svelte b/src/components/Course/components/Navigation/NavExpandable.svelte new file mode 100644 index 00000000..ec1eced2 --- /dev/null +++ b/src/components/Course/components/Navigation/NavExpandable.svelte @@ -0,0 +1,66 @@ + + +
+
+ {#if !hideSortIcon} + + {/if} + {label} +
+ {#if isExpanded} +
+ +
+ {/if} +
+ + diff --git a/src/components/Course/components/Navigation/index.svelte b/src/components/Course/components/Navigation/index.svelte index 77ed6ee5..6f048ce0 100644 --- a/src/components/Course/components/Navigation/index.svelte +++ b/src/components/Course/components/Navigation/index.svelte @@ -7,7 +7,7 @@ import Settings20 from 'carbon-icons-svelte/lib/Settings20'; import ChevronLeft16 from 'carbon-icons-svelte/lib/ChevronLeft16'; import ChevronRight16 from 'carbon-icons-svelte/lib/ChevronRight16'; - import Expandable from '../../../Expandable/index.svelte'; + import NavExpandable from './NavExpandable.svelte'; import PageNav from '../../../PageNav/index.svelte'; import IconButton from '../../../IconButton/index.svelte'; import Avatar from '../../../Avatar/index.svelte'; @@ -152,7 +152,7 @@ diff --git a/src/components/CourseLandingPage/components/Editor/Container.svelte b/src/components/CourseLandingPage/components/Editor/Container.svelte new file mode 100644 index 00000000..d1b1d034 --- /dev/null +++ b/src/components/CourseLandingPage/components/Editor/Container.svelte @@ -0,0 +1,74 @@ + + +
+ {#if show} +
+ +
+ {/if} + +
+ (show = !show)} + size={$isMobile ? 'large' : 'small'} + toolTipProps={$isMobile + ? {} + : { + title: 'Toggle editor', + hotkeys: ['B'], + direction: 'right', + }} + > + {#if show} + + {:else} + + {/if} + +
+
+ + diff --git a/src/components/CourseLandingPage/components/Editor/index.svelte b/src/components/CourseLandingPage/components/Editor/index.svelte new file mode 100644 index 00000000..7d86a939 --- /dev/null +++ b/src/components/CourseLandingPage/components/Editor/index.svelte @@ -0,0 +1,38 @@ + + + +

Builder

+ + {#each sections as section} + + {/each} +
diff --git a/src/components/CourseLandingPage/index.svelte b/src/components/CourseLandingPage/index.svelte new file mode 100644 index 00000000..766f3a12 --- /dev/null +++ b/src/components/CourseLandingPage/index.svelte @@ -0,0 +1,207 @@ + + + + {data.title} + + +
+
+
+
+

+ {data.title} +

+
+ {data.shortDescription} +
+
+ + + Last updated 10/2021 + +
+
+
+

+ + Estimated 8 weeks +

+

+ + {data.cost.currency}{data.cost.price} +

+ +
+
+
+ + + + + + + + + + + + + {#each data.lessons as lesson, index} +
+ Lesson {index + 1}. + {lesson.title} +
+ {/each} +
+ + +
+ {data.aboutUs.companyName} +
+ +
+
+ + diff --git a/src/components/Expandable/index.svelte b/src/components/Expandable/index.svelte index ab080627..9c699956 100644 --- a/src/components/Expandable/index.svelte +++ b/src/components/Expandable/index.svelte @@ -1,66 +1,57 @@ -
+
- {#if !hideSortIcon} - +

+ {title} + {#if supportsLink} + e.stopPropagation()} + > + + + {/if} +

+ + {#if isExpanded} + + {:else} + {/if} - {label}
{#if isExpanded} -
+
{/if}
- - diff --git a/src/components/MarkdownRender/index.svelte b/src/components/MarkdownRender/index.svelte index dc167f11..26e028b6 100644 --- a/src/components/MarkdownRender/index.svelte +++ b/src/components/MarkdownRender/index.svelte @@ -2,10 +2,21 @@ import marked from 'marked'; export let content = ''; + export let disableMaxWidth = false; -
+
{#if !!content} {@html marked(content, { breaks: true, gfm: true })} {/if}
+ + diff --git a/src/components/Tailwindcss.svelte b/src/components/Tailwindcss.svelte index 5a4e4184..68125266 100644 --- a/src/components/Tailwindcss.svelte +++ b/src/components/Tailwindcss.svelte @@ -7,6 +7,7 @@ html { --scrollbarBG: #fff; --thumbBG: #ccc; + scroll-behavior: smooth; } #calendar .grid { diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index 6af0f2bc..c5e2b842 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -102,7 +102,7 @@ } function isCoursePage(path) { - return /courses\/[a-z 0-9 -]/.test(path); + return /course[s]*\/[a-z 0-9 -]/.test(path); } function handleResize() { diff --git a/src/routes/course/[slug].svelte b/src/routes/course/[slug].svelte new file mode 100644 index 00000000..aa88d4cc --- /dev/null +++ b/src/routes/course/[slug].svelte @@ -0,0 +1,34 @@ + + + + +
+ +
+ +
+
+ +