From a3e50477b069ac2bfe127703fe7fad60992e6a97 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 30 Jul 2024 15:13:31 +0200 Subject: [PATCH] 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. --- example.css | 10 ++++++++++ example.html | 3 ++- example.js | 12 +++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/example.css b/example.css index 681b869..340f61c 100644 --- a/example.css +++ b/example.css @@ -40,4 +40,14 @@ footer { footer a { color: white; +} + +.footer-left { + float: left; + margin-left: 1em; +} + +.footer-right { + float: right; + margin-right: 1em; } \ No newline at end of file diff --git a/example.html b/example.html index ab41210..b2d8cdf 100644 --- a/example.html +++ b/example.html @@ -22,7 +22,8 @@ diff --git a/example.js b/example.js index 7f0d8cc..0eb75c2 100644 --- a/example.js +++ b/example.js @@ -17,4 +17,14 @@ document.addEventListener('DOMContentLoaded', () => { console.log('State loaded on page load!'); } -}); \ No newline at end of file +}); + +function clearState() { + if (!confirm('Are you sure you want to clear the state?')) { + return; + } + + localStorage.removeItem('kanblendarState'); + console.log('State cleared!'); + document.location.reload(); +} \ No newline at end of file