Browse Source

Login Page

Frontend-Kenny-Attempt-1
DariusTFox 3 years ago
parent
commit
46529ddd38
  1. 10
      client/src/App.svelte
  2. 19
      client/src/Button.svelte
  3. 6
      client/src/CardBG.svelte
  4. 23
      client/src/InputField.svelte
  5. 37
      client/src/Login.svelte
  6. 8
      client/tailwind.config.js

10
client/src/App.svelte

@ -8,18 +8,18 @@ import MainPage from "./MainPage.svelte";
} }
</script> </script>
<main class="bg-banner bg-cover bg-center h-screen"> <main class="bg-banner bg-cover bg-center h-screen font-sans">
<button on:click={toggleLoggedIn}>
toggle
</button>
{#if loggedin} {#if loggedin}
<MainPage></MainPage> <MainPage></MainPage>
{:else} {:else}
<Login></Login> <Login on:loginSuccess={toggleLoggedIn}></Login>
{/if} {/if}
</main> </main>
<style global lang="postcss"> <style global lang="postcss">
@import url('https://fonts.googleapis.com/css2?family=Geo&family=Roboto&family=Rochester&display=swap');
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;

19
client/src/Button.svelte

@ -1,11 +1,18 @@
<script> <script>
export let title;
export let text;
</script> </script>
<main> <main>
<figure class="bg-gray-100 rounded-xl p-3 m-2"> <button on:click class="rounded-2xl p-6 w-full text-center text-3xl text-gray-50">
<h1 class="text-lg font-bold">{title}</h1> <slot></slot>
<p class="text-gray-900">{text}</p> </button>
</figure>
</main> </main>
<style>
button{
background: linear-gradient(272.39deg, rgba(247, 175, 67, 0.93) -34.2%, rgba(245, 72, 17, 0.93) 100%);
box-shadow: 0px 8px 4px rgba(0, 0, 0, 0.25);
border-radius: 20px;
}
</style>

6
client/src/CardBG.svelte

@ -1,10 +1,13 @@
<script> <script>
export let width; export let width;
export let height; export let height;
let clazz;
export {clazz as class}
</script> </script>
<main> <main>
<figure class="rounded-x p-3 m-14" style="--width: {width}; --height: {height};"> <figure class="rounded-x p-3 m-14 {clazz}" style="--width: {width}; --height: {height};">
<slot></slot> <slot></slot>
</figure> </figure>
</main> </main>
@ -18,5 +21,4 @@
box-shadow: 0px 13px 6px 4px rgba(0, 0, 0, 0.25); box-shadow: 0px 13px 6px 4px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(12px); backdrop-filter: blur(12px);
} }
</style> </style>

23
client/src/InputField.svelte

@ -1,11 +1,22 @@
<script> <script>
export let title; export let isPassword;
export let text; export let placeholder;
export let value;
const handleInput = e => {
value = e.target.value;
}
</script> </script>
<main> <main>
<figure class="bg-gray-100 rounded-xl p-3 m-2"> <input type={isPassword ? "password" : "text"} placeholder={placeholder} value={value} on:input={handleInput} class="placeholder-gray-300 p-3 text-gray-50 w-full text-3xl">
<h1 class="text-lg font-bold">{title}</h1>
<p class="text-gray-900">{text}</p>
</figure>
</main> </main>
<style>
input{
background: linear-gradient(92.55deg, rgba(76, 172, 135, 0.95) -28.27%, rgba(249, 224, 127, 0.096) 115.79%);
filter: drop-shadow(0px 8px 4px rgba(0, 0, 0, 0.25));
border-radius: 3px;
}
</style>

37
client/src/Login.svelte

@ -1,14 +1,47 @@
<script> <script>
import Button from "./Button.svelte";
import CardBG from "./CardBG.svelte"; import CardBG from "./CardBG.svelte";
import InputField from "./InputField.svelte";
import {createEventDispatcher} from 'svelte';
const dispatch = createEventDispatcher();
let username = "";
let code = "";
function checkLogin(){
//todo: CHeck here
dispatch("loginSuccess",null);
}
</script> </script>
<main> <main>
<div class="container h-screen flex flex-col justify-center"> <div class="container h-screen flex flex-col justify-center">
<CardBG width="464px" height="550px"> <CardBG width="464px" height="550px" class="flex flex-col items-stretch">
<h1>Login</h1> <h1 class='font-welcome text-7xl text-gray-50 m-6 border-b-2'>Welcome,</h1>
<div class="m-3 flex-shrink">
<InputField placeholder="Username" isPassword={false} value={username}></InputField>
</div>
<div class="m-3 flex-shrink">
<InputField placeholder="Code" isPassword={true} value={code}></InputField>
</div>
<div class="m-3 flex-shrink">
<Button on:click={checkLogin}>Login</Button>
</div>
<div class="flex-grow">
</div>
<div class="flex">
<a href='https://google.com' class='text-3xl text-gray-400 m-6 flex-auto text-center'>Help!</a>
<a href='https://google.com' class='text-3xl text-gray-400 m-6 flex-auto text-center'>Can't login?</a>
</div>
</CardBG> </CardBG>
</div> </div>

8
client/tailwind.config.js

@ -11,7 +11,13 @@ module.exports = {
extend: { extend: {
backgroundImage:{ backgroundImage:{
"banner":"url('/img/Banner.jpg')" "banner":"url('/img/Banner.jpg')"
} },
fontFamily:{
"title":['Geo', 'sans-serif'],
"welcome":['Rochester', 'cursive'],
"sans":['Roboto', 'sans-serif']
},
}, },
}, },
variants: { variants: {

Loading…
Cancel
Save