Styling updates
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
"description": "unidiscuss",
|
"description": "unidiscuss",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "sapper dev",
|
"dev": "nvm use 11.0.0 && sapper dev",
|
||||||
"build": "sapper build --legacy",
|
"build": "sapper build --legacy",
|
||||||
"export": "sapper export --legacy",
|
"export": "sapper export --legacy",
|
||||||
"start": "node __sapper__/build"
|
"start": "node __sapper__/build"
|
||||||
|
|||||||
@@ -43,6 +43,55 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="root">
|
||||||
|
<PageNav title="React.JS" />
|
||||||
|
<div>
|
||||||
|
<Expandable
|
||||||
|
label="Overview"
|
||||||
|
handleClick={handleMainGroupClick("/courses/1")}
|
||||||
|
isGroupActive={$page.path === "/courses/1"}
|
||||||
|
hideSortIcon
|
||||||
|
/>
|
||||||
|
<Expandable label="Lectures">
|
||||||
|
{#each lectures as lecture, index}
|
||||||
|
<a
|
||||||
|
class="item {(lecture.link === $page.path ||
|
||||||
|
!$page.path.length > 3) &&
|
||||||
|
'active'} pl-7 py-2"
|
||||||
|
href={lecture.link}
|
||||||
|
>
|
||||||
|
<span class="course-counter"> {getLectureNo(index)} </span>
|
||||||
|
<span>{lecture.title}</span>
|
||||||
|
</a>
|
||||||
|
{/each}
|
||||||
|
</Expandable>
|
||||||
|
<Expandable
|
||||||
|
label="People"
|
||||||
|
handleClick={handleMainGroupClick("/courses/1/people")}
|
||||||
|
isGroupActive={$page.path === "/courses/1/people"}
|
||||||
|
hideSortIcon
|
||||||
|
/>
|
||||||
|
<Expandable
|
||||||
|
label="Timetable"
|
||||||
|
handleClick={handleMainGroupClick("/courses/1/timetable")}
|
||||||
|
isGroupActive={$page.path === "/courses/1/timetable"}
|
||||||
|
hideSortIcon
|
||||||
|
/>
|
||||||
|
<Expandable
|
||||||
|
label="Scoreboard"
|
||||||
|
handleClick={handleMainGroupClick("/courses/1/score")}
|
||||||
|
isGroupActive={$page.path === "/courses/1/score"}
|
||||||
|
hideSortIcon
|
||||||
|
/>
|
||||||
|
<Expandable
|
||||||
|
label="Home tasks"
|
||||||
|
handleClick={handleMainGroupClick("/courses/1/hometasks")}
|
||||||
|
isGroupActive={$page.path === "/courses/1/hometasks"}
|
||||||
|
hideSortIcon
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.root {
|
.root {
|
||||||
height: 90vh;
|
height: 90vh;
|
||||||
@@ -70,49 +119,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
|
font-size: 0.875rem;
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: #cae2f9;
|
background-color: #cae2f9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="root">
|
|
||||||
<PageNav title="React.JS" />
|
|
||||||
<div>
|
|
||||||
<Expandable
|
|
||||||
label="Overview"
|
|
||||||
handleClick={handleMainGroupClick('/courses/1')}
|
|
||||||
isGroupActive={$page.path === '/courses/1'}
|
|
||||||
hideSortIcon />
|
|
||||||
<Expandable label="Lectures">
|
|
||||||
{#each lectures as lecture, index}
|
|
||||||
<a
|
|
||||||
class="item {(lecture.link === $page.path || !$page.path.length > 3) && 'active'} pl-7 py-2"
|
|
||||||
href={lecture.link}>
|
|
||||||
<span class="course-counter"> {getLectureNo(index)} </span>
|
|
||||||
<span>{lecture.title}</span>
|
|
||||||
</a>
|
|
||||||
{/each}
|
|
||||||
</Expandable>
|
|
||||||
<Expandable
|
|
||||||
label="People"
|
|
||||||
handleClick={handleMainGroupClick('/courses/1/people')}
|
|
||||||
isGroupActive={$page.path === '/courses/1/people'}
|
|
||||||
hideSortIcon />
|
|
||||||
<Expandable
|
|
||||||
label="Timetable"
|
|
||||||
handleClick={handleMainGroupClick('/courses/1/timetable')}
|
|
||||||
isGroupActive={$page.path === '/courses/1/timetable'}
|
|
||||||
hideSortIcon />
|
|
||||||
<Expandable
|
|
||||||
label="Scoreboard"
|
|
||||||
handleClick={handleMainGroupClick('/courses/1/score')}
|
|
||||||
isGroupActive={$page.path === '/courses/1/score'}
|
|
||||||
hideSortIcon />
|
|
||||||
<Expandable
|
|
||||||
label="Home tasks"
|
|
||||||
handleClick={handleMainGroupClick('/courses/1/hometasks')}
|
|
||||||
isGroupActive={$page.path === '/courses/1/hometasks'}
|
|
||||||
hideSortIcon />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,44 +1,106 @@
|
|||||||
<script>
|
<script>
|
||||||
import yaml from "js-yaml";
|
|
||||||
import RadioQuestion from "../../../RadioQuestion/index.svelte";
|
import RadioQuestion from "../../../RadioQuestion/index.svelte";
|
||||||
import PrimaryButton from "../../../PrimaryButton/index.svelte";
|
import PrimaryButton from "../../../PrimaryButton/index.svelte";
|
||||||
import EditMode from "../../../EditMode/index.svelte";
|
|
||||||
import { generateQuestion } from "./functions";
|
|
||||||
|
|
||||||
export let mode;
|
|
||||||
|
|
||||||
let someYamlFile = `
|
|
||||||
about: This is the description of the home task
|
|
||||||
questions:
|
|
||||||
- title: Where is the founder of react?
|
|
||||||
type: radio
|
|
||||||
options:
|
|
||||||
- label: Mark Zukerberg
|
|
||||||
- label: Trake Towa
|
|
||||||
- label: Emeka Igwe
|
|
||||||
answer: true
|
|
||||||
- title: Who is the founder of react?
|
|
||||||
type: radio
|
|
||||||
options:
|
|
||||||
- label: Evan Vue
|
|
||||||
answer: true
|
|
||||||
- label: Richard Brandson
|
|
||||||
- label: Collison True
|
|
||||||
`;
|
|
||||||
const questionnaire = yaml.load(someYamlFile, "utf8");
|
|
||||||
const questions = generateQuestion(questionnaire.questions);
|
|
||||||
let answers = {};
|
let answers = {};
|
||||||
let currentQuestionIndex = 0;
|
let currentQuestionIndex = 0;
|
||||||
let currentQuestion = {};
|
let currentQuestion = {};
|
||||||
|
|
||||||
|
const questions = [
|
||||||
|
{
|
||||||
|
name: "react-founder",
|
||||||
|
type: "radio",
|
||||||
|
title: "Who is the creator of React.js",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Dan Abrahmov",
|
||||||
|
value: "danabrahmov",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Google",
|
||||||
|
value: "google",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Facebook",
|
||||||
|
value: "Facebook",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Traversy Media",
|
||||||
|
value: "traversymedia",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "vue-founder",
|
||||||
|
type: "radio",
|
||||||
|
title: "Who is the creator of Vue.js",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Evan Vue",
|
||||||
|
value: "evan-vue",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Mark Zukerberg",
|
||||||
|
value: "mark",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Prince Charles",
|
||||||
|
value: "prince-charles",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Bill Gates",
|
||||||
|
value: "gates-bill",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "svelte-founder",
|
||||||
|
type: "radio",
|
||||||
|
title: "Who is the creator of Svelte.js",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Hillary Svelte",
|
||||||
|
value: "danabrahmov",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Mircosoft",
|
||||||
|
value: "microsoft",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Elevate",
|
||||||
|
value: "elevate",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Coding Train",
|
||||||
|
value: "coding-train",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "angular-founder",
|
||||||
|
type: "radio",
|
||||||
|
title: "Who is the creator of Angular.js",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: "Laryy page",
|
||||||
|
value: "larry-page",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Google",
|
||||||
|
value: "google",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Sales Force",
|
||||||
|
value: "sales-force",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
function handleStart() {
|
function handleStart() {
|
||||||
currentQuestionIndex += 1;
|
currentQuestionIndex += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPrevious() {
|
|
||||||
currentQuestionIndex -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(name, value) {
|
function onSubmit(name, value) {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
answers = {
|
answers = {
|
||||||
@@ -49,35 +111,41 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: currentQuestion = questions[currentQuestionIndex - 1];
|
$: currentQuestion = questions[currentQuestionIndex - 1];
|
||||||
|
|
||||||
|
function onPrevious() {
|
||||||
|
currentQuestionIndex -= 1;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<EditMode value={someYamlFile}>
|
{#if currentQuestionIndex === 0}
|
||||||
<div slot="preview">
|
<div>
|
||||||
{#if currentQuestionIndex === 0}
|
<h2>Home task 1</h2>
|
||||||
<div>
|
<p>
|
||||||
<h2>Home task 1</h2>
|
You will be to answer 10 questions, it isn't timed so you can take your
|
||||||
<p>{questionnaire.about}</p>
|
time to answer. You can also continue from where you left off, you don't
|
||||||
|
need to worry cause everything is automatically syncronized in the cloud.
|
||||||
|
</p>
|
||||||
|
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
onClick={handleStart}
|
onClick={handleStart}
|
||||||
label="Start"
|
label="Start"
|
||||||
className="my-5"
|
className="my-5"
|
||||||
type="button" />
|
type="button"
|
||||||
</div>
|
/>
|
||||||
{:else if !currentQuestion}
|
|
||||||
<pre>
|
|
||||||
<code>{JSON.stringify(answers)}</code>
|
|
||||||
</pre>
|
|
||||||
{:else}
|
|
||||||
<RadioQuestion
|
|
||||||
title={currentQuestionIndex + '. ' + currentQuestion.title}
|
|
||||||
name={currentQuestion.name}
|
|
||||||
options={currentQuestion.options}
|
|
||||||
defaultValue={answers[currentQuestion.name] || false}
|
|
||||||
{onSubmit}
|
|
||||||
{onPrevious}
|
|
||||||
disablePreviousButton={currentQuestionIndex === 1}
|
|
||||||
isLast={currentQuestionIndex === questions.length} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</EditMode>
|
{:else if !currentQuestion}
|
||||||
|
<pre>
|
||||||
|
<code>{JSON.stringify(answers)}</code>
|
||||||
|
</pre>
|
||||||
|
{:else}
|
||||||
|
<RadioQuestion
|
||||||
|
title={currentQuestionIndex + ". " + currentQuestion.title}
|
||||||
|
name={currentQuestion.name}
|
||||||
|
options={currentQuestion.options}
|
||||||
|
defaultValue={answers[currentQuestion.name] || false}
|
||||||
|
{onSubmit}
|
||||||
|
{onPrevious}
|
||||||
|
disablePreviousButton={currentQuestionIndex === 1}
|
||||||
|
isLast={currentQuestionIndex === questions.length}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
export let placeholder;
|
export let placeholder;
|
||||||
export let value;
|
export let value;
|
||||||
export let options = [];
|
export let options = [];
|
||||||
|
|
||||||
let answer = "Work on ";
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label class="block">
|
<label class="block">
|
||||||
|
|||||||
Reference in New Issue
Block a user