Changes to colors
This commit is contained in:
parent
32d131db67
commit
c713fcaae8
@ -14,8 +14,12 @@
|
|||||||
--c-bg: white;
|
--c-bg: white;
|
||||||
--c-on-bg: #09090b;
|
--c-on-bg: #09090b;
|
||||||
--c-border-1: #a1a1aa;
|
--c-border-1: #a1a1aa;
|
||||||
|
|
||||||
--c-primary: #7c3aed;
|
--c-primary: #7c3aed;
|
||||||
--c-on-primary: white;
|
--c-on-primary: white;
|
||||||
|
|
||||||
|
--c-primary-bg: #f5f3ff;
|
||||||
|
--c-primary-border: #c4b5fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,26 @@
|
|||||||
import { Show, createSignal } from "solid-js";
|
import { Show, createSignal, onMount } from "solid-js";
|
||||||
import { Login as GoLogin } from "../../wailsjs/go/main/App";
|
import { Login as GoLogin } from "../../wailsjs/go/main/App";
|
||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
|
|
||||||
|
function runAndDelay(ms: number, fn: () => void): Promise<void> {
|
||||||
|
fn();
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(resolve, ms);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const delay = (ms: number, fn: () => void) => new Promise((resolve) => setTimeout(() => {
|
||||||
|
fn();
|
||||||
|
resolve(null);
|
||||||
|
}, ms));
|
||||||
|
|
||||||
export function Login() {
|
export function Login() {
|
||||||
const [loading, setLoading] = createSignal(false);
|
const [loading, setLoading] = createSignal(false);
|
||||||
const [error, setError] = createSignal("");
|
const [error, setError] = createSignal("");
|
||||||
const [server, setServer] = createSignal("");
|
const [server, setServer] = createSignal("");
|
||||||
const [username, setUsername] = createSignal("");
|
const [username, setUsername] = createSignal("");
|
||||||
const [password, setPassword] = createSignal("");
|
const [password, setPassword] = createSignal("");
|
||||||
const [fade, setFade] = createSignal(false);
|
const [fadeUI, setFadeUI] = createSignal(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const login = async(ev: Event) => {
|
const login = async(ev: Event) => {
|
||||||
@ -17,30 +29,31 @@ export function Login() {
|
|||||||
setError("");
|
setError("");
|
||||||
|
|
||||||
GoLogin(server(), username(), password())
|
GoLogin(server(), username(), password())
|
||||||
.then(() => {
|
.then(() => runAndDelay(150, () => setFadeUI(true)))
|
||||||
setFade(true);
|
.then(() => navigate("/home"))
|
||||||
setTimeout(() => {
|
|
||||||
navigate("/home");
|
|
||||||
}, 150);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setError(err);
|
setError(err);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
setFadeUI(true);
|
||||||
|
delay(150, () => setFadeUI(false));
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={`w-screen h-screen flex items-center justify-center ${fade() ? "opacity-0" : "opacity-100"} transition-opacity`}>
|
<div class={`w-screen h-screen flex items-center justify-center ${fadeUI() ? "opacity-0" : "opacity-100"} transition-opacity`}>
|
||||||
<div class="max-w-80 px-1 overflow-hidden">
|
<div class="max-w-80 px-1 overflow-hidden">
|
||||||
<form onSubmit={login}>
|
<form onSubmit={login}>
|
||||||
<h1 class="text-center font-title font-black text-xl text-c-primary my-4">Login to Navidrome</h1>
|
<h1 class="text-center font-title font-black text-xl text-c-primary mb-4">Login to Navidrome</h1>
|
||||||
<label for="login-server">
|
<label for="login-server">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
<span class="font-title label-text text-xs">Server URL:</span>
|
<span class="font-title label-text text-xs">Server URL:</span>
|
||||||
</div>
|
</div>
|
||||||
<input id="login-server" type="text"
|
<input id="login-server" type="text"
|
||||||
onInput={(e) => setServer(e.target.value)}
|
onInput={(e) => setServer(e.target.value)}
|
||||||
class="border border-c-border-1 rounded inline-block w-full p-1"
|
class="border border-c-primary-border rounded bg-c-primary-bg inline-block w-full p-1"
|
||||||
placeholder="https://"
|
placeholder="https://"
|
||||||
required
|
required
|
||||||
disabled={loading()}
|
disabled={loading()}
|
||||||
@ -52,7 +65,7 @@ export function Login() {
|
|||||||
</div>
|
</div>
|
||||||
<input id="login-username" type="text"
|
<input id="login-username" type="text"
|
||||||
onInput={(e) => setUsername(e.target.value)}
|
onInput={(e) => setUsername(e.target.value)}
|
||||||
class="border border-c-border-1 rounded inline-block w-full p-1"
|
class="border border-c-primary-border rounded bg-c-primary-bg inline-block w-full p-1"
|
||||||
placeholder="username"
|
placeholder="username"
|
||||||
required
|
required
|
||||||
disabled={loading()}
|
disabled={loading()}
|
||||||
@ -64,7 +77,7 @@ export function Login() {
|
|||||||
</div>
|
</div>
|
||||||
<input id="login-password" type="password"
|
<input id="login-password" type="password"
|
||||||
onInput={(e) => setPassword(e.target.value)}
|
onInput={(e) => setPassword(e.target.value)}
|
||||||
class="border border-c-border-1 rounded inline-block w-full p-1"
|
class="border border-c-primary-border rounded bg-c-primary-bg inline-block w-full p-1"
|
||||||
placeholder="********"
|
placeholder="********"
|
||||||
required
|
required
|
||||||
disabled={loading()}
|
disabled={loading()}
|
||||||
@ -74,7 +87,7 @@ export function Login() {
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class={`rounded font-title bg-c-primary text-c-on-primary py-2 px-4 mt-2 ${loading() ? "animate-pulse" : ""}`}
|
class={`rounded font-title bg-c-primary text-c-on-primary py-2 px-4 mt-6 ${loading() ? "animate-pulse" : ""}`}
|
||||||
disabled={loading()}
|
disabled={loading()}
|
||||||
>
|
>
|
||||||
Login
|
Login
|
||||||
|
@ -17,6 +17,8 @@ export default {
|
|||||||
"c-border-1": "var(--c-border-1)",
|
"c-border-1": "var(--c-border-1)",
|
||||||
"c-primary": "var(--c-primary)",
|
"c-primary": "var(--c-primary)",
|
||||||
"c-on-primary": "var(--c-on-primary)",
|
"c-on-primary": "var(--c-on-primary)",
|
||||||
|
"c-primary-bg": "var(--c-primary-bg)",
|
||||||
|
"c-primary-border": "var(--c-primary-border)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user