making the homepage look a bit fancier

This commit is contained in:
Michael Zhang 2021-08-28 03:35:34 -05:00
parent 5671385c00
commit b8b01e4a4a
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 128 additions and 8 deletions

10
web/src/lib/Question.ts Normal file
View file

@ -0,0 +1,10 @@
export default class Question {
public description: string;
public choices: Choice[];
public concepts: string[];
};
export class Choice {
public text: string;
public correct: boolean;
};

View file

@ -1,16 +1,45 @@
<script lang="ts"> <script lang="ts">
import type Question from "$lib/Question";
export let question: Question = {
description: `
what is 1 + 1?
`,
concepts: [ "addition" ],
choices: [
{ text: "1", correct: false },
{ text: "2", correct: true },
{ text: "3", correct: false },
],
};
let state = "ask"; let state = "ask";
let wasCorrect = false;
let choose = (index: number) => {
state = "answer";
wasCorrect = question.choices[index].correct;
};
</script> </script>
<div class="quiz-box"> <div class="quiz-box">
{#if state == "ask" } {#if state == "ask" }
<small>Q:</small> <small>Q:</small>
<p>what is 1 + 1?</p> <p>{ question.description }</p>
<ul> <ul>
{#each question.choices as choice, index }
<li>
<button on:click={() => choose(index)}>{ choice.text }</button>
</li>
{/each}
</ul> </ul>
{:else} {:else}
<small>A:</small> <small>A:</small>
{#if wasCorrect }
<p>you Got it!</p> <p>you Got it!</p>
{:else}
<p>you Failed</p>
{/if}
{/if} {/if}
</div> </div>

View file

@ -1,15 +1,40 @@
<div id="app"> <div id="app" class="container">
<header class="header"> <header class="header">
<div class="brand"><a href="/">Edu</a></div> <div class="brand"><a href="/">Edu</a></div>
<nav class="header-nav"> <nav class="header-nav">
<ul class="list"> <ul class="list list-reset">
<li><a href="/">Home</a></li> <li><a href="/">Home</a></li>
<li><a href="/learn">Learn</a></li>
<li><a href="/browse">Browse</a></li>
<li><a href="/login">Login</a></li> <li><a href="/login">Login</a></li>
</ul> </ul>
</nav> </nav>
</header> </header>
<slot></slot> <slot></slot>
<footer class="footer">
<div class="footer-blocks">
<div class="footer-block">
<div class="footer-block-title">For Students</div>
<ul class="list-reset">
<li><a href="/about">Edu</a></li>
<li><a href="/about">Edu</a></li>
<li><a href="/about">Edu</a></li>
<li><a href="/about">Edu</a></li>
</ul>
</div>
<div class="footer-block">
<div class="footer-block-title">About Us</div>
<ul class="list-reset">
<li><a href="/about">About Me</a></li>
<li><a href="/about">About Me</a></li>
<li><a href="/about">About Me</a></li>
<li><a href="/about">About Me</a></li>
</ul>
</div>
</div>
</footer>
</div> </div>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -17,6 +42,34 @@
font-family: sans-serif; font-family: sans-serif;
} }
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
}
@media (min-width: 1200px) {
.container {
width: 1170px;
}
}
.list-reset {
list-style: none;
padding: 0;
justify-content: flex-end;
}
.header { .header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -37,10 +90,6 @@
white-space: nowrap; white-space: nowrap;
margin-bottom: 0; margin-bottom: 0;
list-style: none;
padding: 0;
justify-content: flex-end;
li { li {
margin: 0; margin: 0;
box-sizing: inherit; box-sizing: inherit;
@ -55,4 +104,32 @@
} }
} }
} }
.footer {
.footer-blocks {
display: flex;
flex-wrap: wrap;
margin-right: -24px;
margin-left: -24px;
margin-top: -12px;
.footer-block {
flex-grow: 1;
flex-basis: 160px;
box-sizing: content-box;
padding: 12px 24px;
.footer-block-title {
text-transform: uppercase;
font-weight: bold;
line-height: 22px;
}
a {
color: lighten(black, 20%);
text-decoration: none;
}
}
}
}
</style> </style>

View file

@ -5,3 +5,7 @@
<h1>Learn by mastery</h1> <h1>Learn by mastery</h1>
<QuizBox /> <QuizBox />
<p>
yadda yadda yadda what's unique about this mastery based learning appraoch
</p>