feat: add clear state functionality in footer
Introduced a "Delete all entries" link in the footer that clears local storage state upon confirmation from the user. Modified CSS to properly align new footer elements. This improvement enhances user control over stored data, ensuring an easy way to reset the application state.
This commit is contained in:
parent
7b947029c9
commit
a3e50477b0
3 changed files with 23 additions and 2 deletions
10
example.css
10
example.css
|
@ -41,3 +41,13 @@ footer {
|
|||
footer a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.footer-left {
|
||||
float: left;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.footer-right {
|
||||
float: right;
|
||||
margin-right: 1em;
|
||||
}
|
|
@ -22,7 +22,8 @@
|
|||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<p>Brought to you by <a href="https://git.private.coffee/kumi/kanblendar">Kumi</a></p>
|
||||
<div class="footer-left"><a href="#" onclick="javascript:clearState(); return false;">Delete all entries</a></div>
|
||||
<div class="footer-right">Brought to you by <a href="https://git.private.coffee/kumi/kanblendar">Kumi</a></div>
|
||||
</footer>
|
||||
|
||||
<!-- Optional: Developers can define their own modal here -->
|
||||
|
|
10
example.js
10
example.js
|
@ -18,3 +18,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
function clearState() {
|
||||
if (!confirm('Are you sure you want to clear the state?')) {
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.removeItem('kanblendarState');
|
||||
console.log('State cleared!');
|
||||
document.location.reload();
|
||||
}
|
Loading…
Reference in a new issue