-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic login page with no logic (#135)
* feat: add basic login page to frontend with no logic * feat: add submit form function
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<script lang="ts"> | ||
import { Button, Label, Input } from "flowbite-svelte"; | ||
let username: string = ""; | ||
let password: string = ""; | ||
$: formValid = username.length > 0 && password.length > 0; | ||
/** | ||
* Gets run on button "Login" or form submit (pressing enter) | ||
* @todo add login logic with tokens and making a request to the backend | ||
*/ | ||
function submitForm() { | ||
if (!formValid) return; | ||
console.log("submitted"); | ||
console.table({ username, password }); | ||
} | ||
</script> | ||
|
||
<form on:submit={submitForm} class="flex gap-5 flex-col"> | ||
<div> | ||
<Label for="username">Username</Label> | ||
<Input | ||
id="username" | ||
style="width: 300px;" | ||
bind:value={username} | ||
placeholder="Enter your username..." | ||
/> | ||
</div> | ||
|
||
<div> | ||
<Label for="password">Password</Label> | ||
<Input | ||
type="password" | ||
id="password" | ||
style="width: 300px;" | ||
bind:value={password} | ||
placeholder="Enter your password..." | ||
/> | ||
</div> | ||
|
||
<div> | ||
<Button size="lg" type="submit" disabled={!formValid}>Login</Button> | ||
</div> | ||
</form> |