Add play page
This commit is contained in:
11
src/app.html
11
src/app.html
@@ -3,10 +3,21 @@
|
||||
<head>
|
||||
<title>Unluckiest</title>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Afacad+Flux">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Afacad Flux', serif;
|
||||
font-size: 48px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
<link rel="stylesheet" href="%sveltekit.assets%/style/app.css" />
|
||||
<link rel="stylesheet" href="%sveltekit.assets%/style/menu.css" />
|
||||
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
|
||||
%sveltekit.head%
|
||||
|
||||
@@ -33,5 +33,4 @@
|
||||
color: #303633;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@@ -1,5 +1,4 @@
|
||||
<script>
|
||||
import '../app.css';
|
||||
|
||||
import github_mark from '$lib/assets/github-mark-white.svg';
|
||||
import twitter_mark from '$lib/assets/twitter-mark-white.svg';
|
||||
@@ -25,18 +24,16 @@
|
||||
<div class="burger"></div>
|
||||
<nav>
|
||||
|
||||
<NavLink --background-color="#f1ecec" link="/">Leaderboard</NavLink>
|
||||
<NavLink --background-color="#f1ecec" link="/play">Play</NavLink>
|
||||
<NavLink --background-color="#f1ecec" link="/about">About</NavLink>
|
||||
<a href="/">Leaderboard</a>
|
||||
<a href="/play">Play</a>
|
||||
<a href="/about">About</a>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<a href="https://github.com/naaturel">
|
||||
|
||||
@@ -1,4 +1,98 @@
|
||||
<form>
|
||||
<input/>
|
||||
<button>Let's roll</button>
|
||||
</form>
|
||||
<script>
|
||||
|
||||
import {onMount} from "svelte";
|
||||
|
||||
let range = 100;
|
||||
let result = 0;
|
||||
|
||||
onMount(async () => {
|
||||
const jQuery = await import('jquery');
|
||||
const $ = jQuery.default;
|
||||
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
});
|
||||
|
||||
async function roll() {
|
||||
|
||||
toggleLoading();
|
||||
|
||||
result = Math.floor(Math.random() * (range + 1));
|
||||
|
||||
await new Promise(r => setTimeout(r, 3000));
|
||||
|
||||
toggleLoading();
|
||||
window.$(".result").text(`Result : ${result}/${range}`)
|
||||
}
|
||||
|
||||
function toggleLoading(){
|
||||
window.$(".loader").toggleClass("disabled");
|
||||
window.$(".player").toggleClass("disabled");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="loader disabled">
|
||||
<svg class="circular-loader" viewBox="0 0 30 30">
|
||||
<circle class="loader-path" cx="15" cy="15" r="5" fill="none" stroke="#f1ecec" stroke-width="0.7" />
|
||||
</svg>
|
||||
<div class="info">Rolling a random numbers within range 0-{range}...</div>
|
||||
</div>
|
||||
|
||||
<div class="player">
|
||||
<button on:click={roll}>Let's roll !</button>
|
||||
<div class="result"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
|
||||
.disabled
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
.container
|
||||
{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.circular-loader
|
||||
{
|
||||
stroke-dasharray: 100, 125;
|
||||
stroke-dashoffset: -5;
|
||||
animation: rotate 2s ease-in-out infinite;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
||||
.loader-path {
|
||||
width: 25vw;
|
||||
height: 25vh;
|
||||
}
|
||||
|
||||
button
|
||||
{
|
||||
color: black;
|
||||
width: 18vw;
|
||||
height: 18vh;
|
||||
border-radius: 10px;
|
||||
background-color: #f1ecec;
|
||||
border: 2px solid #A1674A;
|
||||
background-size: 1800% 1800%;
|
||||
box-shadow: 0 0 10px #343232;
|
||||
}
|
||||
|
||||
button:hover{
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
to{transform: rotate(360deg)}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,10 +1,6 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root
|
||||
{
|
||||
--font-size : 1vw;
|
||||
--font-size : 1.25vmax;
|
||||
}
|
||||
|
||||
*
|
||||
@@ -23,8 +19,6 @@ h1
|
||||
html
|
||||
{
|
||||
background: linear-gradient(45deg, #b9b9c9, #d2379b);
|
||||
height: 100vh;
|
||||
|
||||
}
|
||||
|
||||
body
|
||||
@@ -32,8 +26,10 @@ body
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
height: 100vh;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
height: 98vh;
|
||||
}
|
||||
|
||||
.container
|
||||
@@ -1,4 +1,4 @@
|
||||
.b-a, .burger:after, .burger:before, .burger {
|
||||
.burger:after, .burger:before, .burger {
|
||||
transition: all 0.25s;
|
||||
content: "";
|
||||
position: absolute;
|
||||
@@ -9,22 +9,6 @@
|
||||
background-color: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
|
||||
.menu-collapsed {
|
||||
transition: all 0.25s;
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 9px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
.menu-collapsed a {
|
||||
transition: all 0s;
|
||||
position: fixed;
|
||||
left: -9000px;
|
||||
}
|
||||
|
||||
.burger {
|
||||
position: fixed;
|
||||
left: 12px;
|
||||
@@ -39,18 +23,38 @@
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.b-a-expanded, .menu-expanded .burger:after, .menu-expanded .burger:before {
|
||||
.menu-expanded .burger:after, .menu-expanded .burger:before {
|
||||
transition: all 0.25s;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
.menu-collapsed {
|
||||
transition: all 0.25s;
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 9px;
|
||||
height: 36px;
|
||||
width: 36px;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.menu-collapsed a {
|
||||
transition: all 0s;
|
||||
position: fixed;
|
||||
left: -9000px;
|
||||
}
|
||||
|
||||
.menu-expanded {
|
||||
transition: all 0.25s;
|
||||
text-align: center;
|
||||
line-height: 200px;
|
||||
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
border-radius: 0px;
|
||||
|
||||
top: 0;
|
||||
left: 0;
|
||||
background-color: rgba(0, 0, 0, 0.85);
|
||||
@@ -59,6 +63,8 @@
|
||||
.menu-expanded a {
|
||||
transition: all 0s;
|
||||
position: relative;
|
||||
width: 100vw;
|
||||
height: 25vh;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user