Skip to content

Commit

Permalink
Add Toasts to Options (#65)
Browse files Browse the repository at this point in the history
* Add toast to options

* Update Toasts Container for Links
  • Loading branch information
smashedr authored May 4, 2024
1 parent ee520f9 commit b4c7466
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 2 additions & 6 deletions src/css/links.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ a:visited {
z-index: 10;
}

#toast-container {
margin-bottom: 60px;
margin-right: 70px;
}

.toast {
.toast-container {
max-width: 260px;
width: 100%;
}
5 changes: 3 additions & 2 deletions src/css/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
min-width: 360px;
}

.toast {
max-width: 260px;
.toast-container {
max-width: 320px;
width: 100%;
}
2 changes: 1 addition & 1 deletion src/html/links.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h5 class="modal-title">Keyboard Shortcuts <i class="fa-regular fa-keyboard ms-2
</div>

<div aria-live="polite" aria-atomic="true" class="">
<div id="toast-container" class="toast-container position-fixed bottom-0 end-0"></div>
<div id="toast-container" class="toast-container position-fixed bottom-0 end-0 p-3"></div>
</div>

<div class="d-none">
Expand Down
5 changes: 5 additions & 0 deletions src/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ async function addFilter(event) {
console.debug('patterns:', patterns)
await chrome.storage.sync.set({ patterns })
updateTable(patterns)
showToast(`Added Filter: ${filter}`)
} else {
showToast(`Filter Exists: ${filter}`, 'warning')
}
}
element.value = ''
Expand Down Expand Up @@ -279,11 +282,13 @@ async function deleteFilter(event, index = undefined) {
}
console.log(`index: ${index}`)
if (index !== undefined) {
const name = patterns[index]
patterns.splice(index, 1)
await chrome.storage.sync.set({ patterns })
console.debug('patterns:', patterns)
updateTable(patterns)
document.getElementById('add-filter').focus()
showToast(`Removed Filter: ${name}`, 'info')
}
}

Expand Down

0 comments on commit b4c7466

Please sign in to comment.