From 89ca2997479cc798317268de3d7aafaeff49b13c Mon Sep 17 00:00:00 2001 From: Isaiah Koontz Date: Sun, 13 Nov 2022 02:17:12 -0800 Subject: [PATCH] Added a "login" button to the main page. Included CSS data and smooth transitions to bring up a login form. * Missing: functions to process the login data. --- frontend/css/index.css | 130 ++++++++++++++++++++++++++++++++++++ frontend/css/login.svg | 18 +++++ frontend/index.html | 43 ++++++++++++ frontend/js/index.js | 12 ++++ frontend/js/loginhandler.js | 0 5 files changed, 203 insertions(+) create mode 100644 frontend/css/login.svg create mode 100644 frontend/js/loginhandler.js diff --git a/frontend/css/index.css b/frontend/css/index.css index bbedb06..5ba30ce 100644 --- a/frontend/css/index.css +++ b/frontend/css/index.css @@ -105,6 +105,136 @@ canvas { filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(82deg) brightness(105%) contrast(105%); } +.login-form-button { + position: absolute; + top: 1vh; + left: 7vw; + cursor: pointer; + border: none; + width: 1.7vw; + z-index: 999999; + filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(82deg) brightness(105%) contrast(105%); +} + +/* The Login Modal CSS */ + +/* Full-width input fields */ +input[type=text], input[type=password] { + width: 100%; + padding: 12px 20px; + margin: 8px 0; + display: inline-block; + border: 1px solid #ccc; + box-sizing: border-box; +} + +/* Set a style for all buttons */ +button { + background-color: #04AA6D; + color: white; + padding: 14px 20px; + margin: 8px 0; + border: none; + cursor: pointer; + width: 100%; +} + +button:hover { + opacity: 0.8; +} + +/* Extra styles for the cancel button */ +.cancelbtn { + width: auto; + padding: 10px 18px; + background-color: #f44336; +} + +/* Center the image and position the close button */ +.imgcontainer { + text-align: center; + margin: 24px 0 12px 0; + position: relative; +} + +img.avatar { + width: 40%; +} + +.container { + padding: 16px; +} + +span.psw { + float: right; + padding-top: 16px; +} + +/* The Login Modal (background) */ +.modal { + position: fixed; /* Stay in place */ + z-index: 1; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ + padding-top: 10px; + visibility: hidden; + opacity: 0; + transition: opacity 0.4s, visibility 0s 0.4s; +} + +/* Use to transition & make visible */ +.modal.show { + top: 0; + opacity: 1; + visibility: visible; + transition: top 0.4s, opacity 0.4s; +} + +/* Modal Content Box */ +.modal-content { + background-color: #fefefe; + margin: 5px 150px; /* from the top and left */ + border: 1px solid #888; + width: 30%; /* Could be more or less, depending on screen size */ +} + +/* The Close Button */ +.close { + /* Position it in the top right corner outside of the modal */ + position: absolute; + right: 25px; + top: 0; + color: #000; + font-size: 35px; + font-weight: bold; + transition: top 0.4s, opacity 0.4s; +} + +/* Close button on hover */ +.close:hover, +.close:focus { + color: red; + cursor: pointer; +} + +/* Change styles for span and cancel button on extra small screens */ +@media screen and (max-width: 300px) { + span.psw { + display: block; + float: none; + } + .cancelbtn { + width: 100%; + } +} + +/* END of The Login Modal CSS */ + @keyframes growonce { 0% { transform: scale(.5,.5) translate(15vw,0); diff --git a/frontend/css/login.svg b/frontend/css/login.svg new file mode 100644 index 0000000..c9caf4d --- /dev/null +++ b/frontend/css/login.svg @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/frontend/index.html b/frontend/index.html index c83c6a0..0040203 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -17,6 +17,39 @@ + + + + + + + @@ -28,5 +61,15 @@ + + diff --git a/frontend/js/index.js b/frontend/js/index.js index 79f1280..94bdfce 100644 --- a/frontend/js/index.js +++ b/frontend/js/index.js @@ -632,6 +632,18 @@ function fullscreen() { } } +// Open the login modal +function openModal() { + let modal = document.getElementById('loginmodal'); + modal.classList.add('show'); +} + +// Close the login modal +function closeModal() { + let modal = document.getElementById('loginmodal'); + modal.classList.remove('show'); +} + // Load the json profile selected async function loadjson(name, active_item) { if (name == 'preview') { diff --git a/frontend/js/loginhandler.js b/frontend/js/loginhandler.js new file mode 100644 index 0000000..e69de29