create common styles for account forms

This commit is contained in:
Ilion Beyst 2022-03-19 21:33:52 +01:00
parent e4e581b346
commit 579f16fc51
6 changed files with 78 additions and 82 deletions

View file

@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import NavbarUserSection from "$lib/components/navbar/NavbarUserSection.svelte";
import "./style.css"; import "./style.css";
</script> </script>
@ -7,16 +9,13 @@
<div class="navbar-main"> <div class="navbar-main">
<a href="/">PlanetWars</a> <a href="/">PlanetWars</a>
</div> </div>
<div class="navbar-user"> <NavbarUserSection />
<a class="navbar-href" href="login">Sign in</a>
<a class="navbar-href" href="register">Sign up</a>
</div>
</div> </div>
<slot /> <slot />
</div> </div>
<style lang="scss"> <style lang="scss">
@import "../lib/variables.scss"; @import "src/styles/variables.scss";
.outer-container { .outer-container {
width: 100vw; width: 100vw;
@ -35,14 +34,6 @@
padding: 0 15px; padding: 0 15px;
} }
.navbar-user a {
font-size: 18px;
color: #eee;
font-family: Helvetica, sans-serif;
padding: 4px 8px;
text-decoration: none;
}
.navbar-main { .navbar-main {
margin: auto 0; margin: auto 0;
} }
@ -52,8 +43,4 @@
color: #eee; color: #eee;
text-decoration: none; text-decoration: none;
} }
.navbar-user {
margin: auto 0;
}
</style> </style>

View file

@ -182,7 +182,7 @@
</div> </div>
<style lang="scss"> <style lang="scss">
@import "../lib/variables.scss"; @import "src/styles/variables.scss";
.container { .container {
display: flex; display: flex;

View file

@ -35,14 +35,21 @@
} }
</script> </script>
{#if loggedIn()}
you are logged in
{/if}
<form on:submit|preventDefault={login}> <div class="page-card">
<label for="username">Username</label> <div class="page-card-content">
<input name="username" bind:value={username} /> <h1 class="page-card-header">Sign in</h1>
<label for="password">Password</label> <form class="account-form" on:submit|preventDefault={login}>
<input type="password" name="password" bind:value={password} /> <label for="username">Username</label>
<button type="submit">Log in</button> <input name="username" bind:value={username} />
</form> <label for="password">Password</label>
<input type="password" name="password" bind:value={password} />
<button type="submit">Submit</button>
</form>
</div>
</div>
<style lang="scss">
@import "src/styles/account_forms.scss";
</style>

View file

@ -31,67 +31,16 @@
<div class="page-card"> <div class="page-card">
<div class="page-card-content"> <div class="page-card-content">
<h1 class="page-card-header">Create account</h1> <h1 class="page-card-header">Create account</h1>
<form class="register-form" on:submit|preventDefault={onSubmit}> <form class="account-form" on:submit|preventDefault={onSubmit}>
<label for="username">Username</label> <label for="username">Username</label>
<input name="username" bind:value={username} /> <input name="username" bind:value={username} />
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" name="password" bind:value={password} /> <input type="password" name="password" bind:value={password} />
<button type="submit">Sign up</button> <button type="submit">Submit</button>
</form> </form>
</div> </div>
</div> </div>
<style lang="scss"> <style lang="scss">
.page-card { @import "src/styles/account_forms.scss";
margin: 50px auto;
width: 40%;
max-width: 600px;
border: 1px solid #b5b5b5;
box-sizing: border-box;
border-radius: 0px;
}
.page-card-content {
margin: 20px 50px;
}
.page-card-header {
padding-top: .5em;
padding-bottom: 1em;
text-align: center;
}
.register-form {
box-sizing: border-box;
display: flex;
flex-direction: column;
font-size: 18px;
}
.register-form label {
margin: 10px 5px;
font-weight: 500;
}
.register-form input {
margin: 10px 5px;
font-size: 1rem;
// height: 2.5em;
display: block;
border-radius: 4px;
border: 1px solid #b5b5b5;
padding: .75rem 1rem;
}
.register-form button {
background-color: lightgreen;
padding: 8px 16px;
border-radius: 8px;
border: 0;
font-size: 18pt;
display: block;
margin: 10px auto;
margin-top: 16px;
}
</style> </style>

View file

@ -0,0 +1,52 @@
.page-card {
margin: 50px auto;
width: 40%;
max-width: 600px;
border: 1px solid #b5b5b5;
box-sizing: border-box;
border-radius: 0px;
}
.page-card-content {
margin: 20px 50px;
}
.page-card-header {
padding-top: 0.5em;
padding-bottom: 1em;
text-align: center;
}
.account-form {
box-sizing: border-box;
display: flex;
flex-direction: column;
font-size: 18px;
}
.account-form label {
margin: 10px 5px;
font-weight: 500;
}
.account-form input {
margin: 10px 5px;
font-size: 1rem;
// height: 2.5em;
display: block;
border-radius: 4px;
border: 1px solid #b5b5b5;
padding: 0.75rem 1rem;
}
.account-form button {
background-color: lightgreen;
padding: 8px 16px;
border-radius: 8px;
border: 0;
font-size: 18pt;
display: block;
margin: 10px auto;
margin-top: 16px;
cursor: pointer;
}

View file

@ -0,0 +1 @@
$bg-color: rgb(41, 41, 41);