Version 0.1.1 - Ajout d'une page de login et de style

This commit is contained in:
Raphix
2023-10-31 17:00:25 +01:00
parent 99f0392a6c
commit 98a6480830
20 changed files with 520 additions and 115 deletions

View File

@ -0,0 +1,35 @@
// Get Document ID
function getID(string) {
return document.getElementById(string)
}
class InfoPop {
constructor(name) {
this.name = name
this.element = getID(this.name)
this.element.style.fontSize = "14px"
}
clear() {
this.element.innerHTML = ""
}
err(text) {
this.element.classList.add("yellow")
this.element.innerHTML = "<i class='fa fa-warning'></i> " + text
}
info(text) {
this.element.classList.remove("yellow")
this.element.innerHTML = "<i class='fa fa-info-circle'></i> " + text
}
}

View File

@ -0,0 +1,22 @@
const username = getID("username")
const password = getID("password")
const submit = getID("submit")
const loginInfo = new InfoPop("login-info")
loginInfo.clear()
submit.addEventListener("click", () => {
if(!username.value) {
loginInfo.err("Le nom d'utilisateur est nécéssaire pour se connecter !")
} else if(!password.value) {
loginInfo.err("Le mot de passe est nécéssaire pour se connecter !")
} else {
loginInfo.clear()
}
})