feat: add Playground module with full-height editor
This commit is contained in:
23
lessons/99-playground.json
Normal file
23
lessons/99-playground.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../schemas/code-crispies-module-schema.json",
|
||||||
|
"id": "playground",
|
||||||
|
"title": "Playground",
|
||||||
|
"description": "Free-form HTML & CSS playground",
|
||||||
|
"mode": "html",
|
||||||
|
"difficulty": "beginner",
|
||||||
|
"lessons": [
|
||||||
|
{
|
||||||
|
"id": "playground",
|
||||||
|
"title": "Playground",
|
||||||
|
"description": "",
|
||||||
|
"task": "",
|
||||||
|
"previewHTML": "",
|
||||||
|
"previewBaseCSS": "body { font-family: system-ui, sans-serif; padding: 20px; }",
|
||||||
|
"sandboxCSS": "",
|
||||||
|
"initialCode": "",
|
||||||
|
"solution": "",
|
||||||
|
"previewContainer": "preview-area",
|
||||||
|
"validations": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
23
lessons/de/99-playground.json
Normal file
23
lessons/de/99-playground.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "../../schemas/code-crispies-module-schema.json",
|
||||||
|
"id": "playground",
|
||||||
|
"title": "Playground",
|
||||||
|
"description": "Freier HTML & CSS Spielplatz",
|
||||||
|
"mode": "html",
|
||||||
|
"difficulty": "beginner",
|
||||||
|
"lessons": [
|
||||||
|
{
|
||||||
|
"id": "playground",
|
||||||
|
"title": "Playground",
|
||||||
|
"description": "",
|
||||||
|
"task": "",
|
||||||
|
"previewHTML": "",
|
||||||
|
"previewBaseCSS": "body { font-family: system-ui, sans-serif; padding: 20px; }",
|
||||||
|
"sandboxCSS": "",
|
||||||
|
"initialCode": "",
|
||||||
|
"solution": "",
|
||||||
|
"previewContainer": "preview-area",
|
||||||
|
"validations": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
11
src/app.js
11
src/app.js
@@ -21,6 +21,7 @@ const elements = {
|
|||||||
helpBtn: document.getElementById("help-btn"),
|
helpBtn: document.getElementById("help-btn"),
|
||||||
|
|
||||||
// Left panel
|
// Left panel
|
||||||
|
instructionsSection: document.querySelector(".instructions"),
|
||||||
editorSection: document.querySelector(".editor-section"),
|
editorSection: document.querySelector(".editor-section"),
|
||||||
modulePill: document.getElementById("module-pill"),
|
modulePill: document.getElementById("module-pill"),
|
||||||
moduleName: document.querySelector(".module-name"),
|
moduleName: document.querySelector(".module-name"),
|
||||||
@@ -384,6 +385,16 @@ function loadCurrentLesson() {
|
|||||||
|
|
||||||
const lesson = engineState.lesson;
|
const lesson = engineState.lesson;
|
||||||
const mode = lesson.mode || engineState.module?.mode || "css";
|
const mode = lesson.mode || engineState.module?.mode || "css";
|
||||||
|
const isPlayground = engineState.module.id === "playground";
|
||||||
|
|
||||||
|
// Handle playground mode - hide instructions, full height editor
|
||||||
|
if (isPlayground) {
|
||||||
|
elements.instructionsSection?.classList.add("hidden");
|
||||||
|
elements.editorSection?.classList.add("playground-mode");
|
||||||
|
} else {
|
||||||
|
elements.instructionsSection?.classList.remove("hidden");
|
||||||
|
elements.editorSection?.classList.remove("playground-mode");
|
||||||
|
}
|
||||||
|
|
||||||
// Add transition class for smooth content swap
|
// Add transition class for smooth content swap
|
||||||
elements.editorSection?.classList.add("transitioning");
|
elements.editorSection?.classList.add("transitioning");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import htmlTablesEN from "../../lessons/30-html-tables.json";
|
|||||||
import htmlMarqueeEN from "../../lessons/31-html-marquee.json";
|
import htmlMarqueeEN from "../../lessons/31-html-marquee.json";
|
||||||
import htmlSvgEN from "../../lessons/32-html-svg.json";
|
import htmlSvgEN from "../../lessons/32-html-svg.json";
|
||||||
import flexboxEN from "../../lessons/flexbox.json";
|
import flexboxEN from "../../lessons/flexbox.json";
|
||||||
|
import playgroundEN from "../../lessons/99-playground.json";
|
||||||
|
|
||||||
// German lesson imports
|
// German lesson imports
|
||||||
import welcomeDE from "../../lessons/de/00-welcome.json";
|
import welcomeDE from "../../lessons/de/00-welcome.json";
|
||||||
@@ -36,6 +37,7 @@ import htmlTablesDE from "../../lessons/de/30-html-tables.json";
|
|||||||
import htmlMarqueeDE from "../../lessons/de/31-html-marquee.json";
|
import htmlMarqueeDE from "../../lessons/de/31-html-marquee.json";
|
||||||
import htmlSvgDE from "../../lessons/de/32-html-svg.json";
|
import htmlSvgDE from "../../lessons/de/32-html-svg.json";
|
||||||
import flexboxDE from "../../lessons/de/flexbox.json";
|
import flexboxDE from "../../lessons/de/flexbox.json";
|
||||||
|
import playgroundDE from "../../lessons/de/99-playground.json";
|
||||||
|
|
||||||
// English module store - ordered by learning path
|
// English module store - ordered by learning path
|
||||||
const moduleStoreEN = [
|
const moduleStoreEN = [
|
||||||
@@ -60,7 +62,9 @@ const moduleStoreEN = [
|
|||||||
flexboxEN,
|
flexboxEN,
|
||||||
responsiveEN,
|
responsiveEN,
|
||||||
// CSS Animationen
|
// CSS Animationen
|
||||||
transitionsAnimationsEN
|
transitionsAnimationsEN,
|
||||||
|
// Playground
|
||||||
|
playgroundEN
|
||||||
];
|
];
|
||||||
|
|
||||||
// German module store - ordered by learning path
|
// German module store - ordered by learning path
|
||||||
@@ -86,7 +90,9 @@ const moduleStoreDE = [
|
|||||||
flexboxDE,
|
flexboxDE,
|
||||||
responsiveDE,
|
responsiveDE,
|
||||||
// CSS Animationen
|
// CSS Animationen
|
||||||
transitionsAnimationsDE
|
transitionsAnimationsDE,
|
||||||
|
// Playground
|
||||||
|
playgroundDE
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -395,6 +395,12 @@ code, kbd {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Playground mode - full height editor */
|
||||||
|
.editor-section.playground-mode {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.code-editor {
|
.code-editor {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user