-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
501 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{ | ||
"id": 1, | ||
"title": "Lesson 1", | ||
"description": "Use basic phrases, talk about food and drink", | ||
"content": [ | ||
{ | ||
"type": "match", | ||
"options": { | ||
"man": "misier", | ||
"woman": "madam", | ||
"bread": "dipain", | ||
"girl": "tifi" | ||
} | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'girl'?", | ||
"answer": "tifi", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} | ||
"id": 1, | ||
"title": "Lesson 1", | ||
"description": "Use basic phrases, talk about food and drink", | ||
"content": [ | ||
{ | ||
"type": "match", | ||
"options": { | ||
"man": "misier", | ||
"woman": "madam", | ||
"bread": "dipain", | ||
"girl": "tifi" | ||
} | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'girl'?", | ||
"answer": "tifi", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"id": 2, | ||
"title": "Lesson 2", | ||
"description": "Greet people, use affirmative phrases", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "Jean"], | ||
"answer": "apel", | ||
"options": ["dipain", "bwar", "apel"], | ||
"translation": "I'm called Jean" | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'rice'?", | ||
"answer": "diri", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} | ||
"id": 2, | ||
"title": "Lesson 2", | ||
"description": "Greet people, use affirmative phrases", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "Jean"], | ||
"answer": "apel", | ||
"options": ["dipain", "bwar", "apel"], | ||
"translation": "I'm called Jean" | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'rice'?", | ||
"answer": "diri", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"id": 3, | ||
"title": "Lesson 3", | ||
"description": "Say what you don't do, use articles", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "koné"], | ||
"answer": "pa", | ||
"options": ["pa", "bwar", "delo"], | ||
"translation": "I don't know" | ||
}, | ||
{ | ||
"type": "translate", | ||
"question": "A boy", | ||
"answer": "Ene garson", | ||
"options": ["tifi", "Ene", "pa", "garson"] | ||
} | ||
] | ||
} | ||
"id": 3, | ||
"title": "Lesson 3", | ||
"description": "Say what you don't do, use articles", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "koné"], | ||
"answer": "pa", | ||
"options": ["pa", "bwar", "delo"], | ||
"translation": "I don't know" | ||
}, | ||
{ | ||
"type": "translate", | ||
"question": "A boy", | ||
"answer": "Ene garson", | ||
"options": ["tifi", "Ene", "pa", "garson"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
{ | ||
"id": 4, | ||
"title": "Lesson 4", | ||
"description": "Discuss food and drink, talk about animals", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "delo"], | ||
"answer": "bwar", | ||
"options": ["dipain", "bwar", "apel"], | ||
"translation": "I drink water" | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'rice'?", | ||
"answer": "diri", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} | ||
"id": 4, | ||
"title": "Lesson 4", | ||
"description": "Discuss food and drink, talk about animals", | ||
"content": [ | ||
{ | ||
"type": "fillBlank", | ||
"question": ["Mo", "delo"], | ||
"answer": "bwar", | ||
"options": ["dipain", "bwar", "apel"], | ||
"translation": "I drink water" | ||
}, | ||
{ | ||
"type": "multipleChoice", | ||
"question": "How do you say 'rice'?", | ||
"answer": "diri", | ||
"options": ["tifi", "diri", "misier"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ body { | |
font-family: 'Quicksand'; | ||
src: url('/fonts/Quicksand.ttf'); | ||
font-display: swap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
<script lang="ts"> | ||
import { drawerStore } from "@skeletonlabs/skeleton"; | ||
import { drawerStore } from '@skeletonlabs/skeleton'; | ||
function drawerOpen(): void { | ||
drawerStore.open({ | ||
width: 'w-[280px] md:w-[400px]', | ||
function drawerOpen(): void { | ||
drawerStore.open({ | ||
width: 'w-[280px] md:w-[400px]' | ||
}); | ||
} | ||
</script> | ||
|
||
<div class="flex items-center"> | ||
<button class="lg:hidden btn btn-sm mr-4" on:click={drawerOpen}> | ||
<span> | ||
<svg viewBox="0 0 100 80" class="fill-token w-4 h-4"> | ||
<rect width="100" height="20" /> | ||
<rect y="30" width="100" height="20" /> | ||
<rect y="60" width="100" height="20" /> | ||
</svg> | ||
</span> | ||
</button> | ||
<a href="/"><strong class="text-xl uppercase">Kreolingo</strong></a> | ||
</div> | ||
<button class="lg:hidden btn btn-sm mr-4" on:click={drawerOpen}> | ||
<span> | ||
<svg viewBox="0 0 100 80" class="fill-token w-4 h-4"> | ||
<rect width="100" height="20" /> | ||
<rect y="30" width="100" height="20" /> | ||
<rect y="60" width="100" height="20" /> | ||
</svg> | ||
</span> | ||
</button> | ||
<a href="/"><strong class="text-xl uppercase">Kreolingo</strong></a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
<a | ||
class="btn hover:variant-ringed" | ||
href="/about" | ||
> | ||
About | ||
</a> | ||
<a class="btn hover:variant-ringed" href="/about"> About </a> | ||
<a | ||
class="btn hover:variant-ringed hidden md:block" | ||
href="https://github.com/laurielim/kreolingo" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
Github | ||
</a> | ||
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
<script lang="ts"> | ||
import { drawerStore } from "@skeletonlabs/skeleton"; | ||
import { drawerStore } from '@skeletonlabs/skeleton'; | ||
function drawerClose() { | ||
drawerStore.close(); | ||
function drawerClose() { | ||
drawerStore.close(); | ||
} | ||
export let lessons: any[]; | ||
export let path: string; | ||
$: classesActive = (href: string) => (href === path.replace("/", "") ? 'variant-ghost-primary' : ''); | ||
export let lessons: any[]; | ||
export let path: string; | ||
$: classesActive = (href: string) => | ||
href === path.replace('/', '') ? 'variant-ghost-primary' : ''; | ||
</script> | ||
|
||
<h2 class="p-4 text-xl"><a href="/">Lessons</a></h2> | ||
<hr /> | ||
<div class="flex flex-col justify-between min-h-[90%]"> | ||
<nav class="list-nav p-4"> | ||
<ul> | ||
{#each lessons as lesson} | ||
<li class="my-2 text-lg"> | ||
<a | ||
class="{classesActive(lesson.slug)}" | ||
href="{lesson.slug}" | ||
on:click={drawerClose}> | ||
{lesson.title} | ||
</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</nav> | ||
<p class="ml-4 pb-2">Created by <a class="anchor" href="//laurielim.github.io/">Laurie Lim Sam</a></p> | ||
</div> | ||
<nav class="list-nav p-4"> | ||
<ul> | ||
{#each lessons as lesson} | ||
<li class="my-2 text-lg"> | ||
<a class={classesActive(lesson.slug)} href={lesson.slug} on:click={drawerClose}> | ||
{lesson.title} | ||
</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</nav> | ||
<p class="ml-4 pb-2"> | ||
Created by <a class="anchor" href="//laurielim.github.io/">Laurie Lim Sam</a> | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
const lessonsDirectory = path.join(process.cwd(), 'lessons') | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
const lessonsDirectory = path.join(process.cwd(), 'lessons'); | ||
|
||
export function getAllLessons() { | ||
const fileNames = fs.readdirSync(lessonsDirectory); | ||
const allLessonsData = fileNames.map((fileName: string) => { | ||
// Remove ".json" from file name to get id | ||
const slug = fileName.replace(/\.json$/, ''); | ||
const fileNames = fs.readdirSync(lessonsDirectory); | ||
const allLessonsData = fileNames.map((fileName: string) => { | ||
// Remove ".json" from file name to get id | ||
const slug = fileName.replace(/\.json$/, ''); | ||
|
||
const lesson = getLessonBySlug(slug); | ||
const lesson = getLessonBySlug(slug); | ||
|
||
return { | ||
slug, | ||
...lesson, | ||
} | ||
}) | ||
return allLessonsData; | ||
return { | ||
slug, | ||
...lesson | ||
}; | ||
}); | ||
return allLessonsData; | ||
} | ||
|
||
export function getLessonBySlug(slug: string) { | ||
// Read file content | ||
const fileName = `${slug}.json` | ||
const fullPath = path.join(lessonsDirectory, fileName) | ||
try { | ||
if (fs.existsSync(fullPath)) { | ||
const fileContents = fs.readFileSync(fullPath, 'utf8') | ||
return JSON.parse(fileContents); | ||
} | ||
} catch(err) { | ||
return null | ||
} | ||
} | ||
// Read file content | ||
const fileName = `${slug}.json`; | ||
const fullPath = path.join(lessonsDirectory, fileName); | ||
try { | ||
if (fs.existsSync(fullPath)) { | ||
const fileContents = fs.readFileSync(fullPath, 'utf8'); | ||
return JSON.parse(fileContents); | ||
} | ||
} catch (err) { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.