JSFiddle - React, Tailwind, and code Playground
by NickU
CSS
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.form {
display: inline-block;
border: 1px solid;
padding: 10px;
position: absolute;
width: 100%;
height: 100%;
background-color: #f1f1f1;
}
#RegForm {
top: 0px;
left:0px;
}
#LoginForm {
top: 0;
left:-100%;
opacity: 0;
}
.input_field {
display: block;
padding: 10px;
width: 100%;
}
.wrapper {
text-align: center;
}
.SubBtn {
padding: 15px;
width: 100%;
font-size: 20px;
cursor: pointer;
margin-top: 10px;
background-color:rgb(10, 157, 248);
border: none;
color: white;
}
.wrapper label {
display: inline-block;
padding: 10px;
font-size: 20px;
}
#container {
position: relative;
width: 300px;
height: 250px;
display: inline-block;
top: 100px;
left:200px;
}
#toggle_form {
position: relative;
top:-50px;
left: 130px;
padding: 5px;
}
JavaScript
function checkStorageAvailability() {
navigator.storage.estimate().then(estimate => {
// Get the available storage space.
const availableStorage = estimate.quota;
// Get the used storage space.
let usedStorage = 0;
try {
usedStorage = localStorage.length;
} catch (e) {
console.error('Error accessing localStorage: ' + e);
}
// Calculate the remaining storage space.
const remainingStorage = availableStorage - usedStorage;
// Display the available and used storage space.
console.log(`Available storage: ${availableStorage} bytes`);
console.log(`Used storage: ${usedStorage} bytes`);
console.log(`Remaining storage: ${remainingStorage} bytes`);
}).catch(err => {
console.error('Error estimating storage: ' + err);
});
}
checkStorageAvailability();