ui: Restyle tags, remove underlining of text

- Tags have important text that is too small and could cause problems with users
with limited vision. Make them regular buttons. Make the buttons shorter and
rounder to resemble previous styling.

- Drop underlining of text in the process.

- In code, don't call them 'badges' anymore.

Tests:

- Run functional tests for tags.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2024-12-12 12:56:37 +02:00
1 parent a094f2a357
commit a4017b2bf2
5 files changed
+21 -15

No files matched your search

+5 -5
View File
@@ -52,9 +52,9 @@ function updatePathWithTags(tags) {
* @returns {string[]} An array of tag names currently displayed.
*/
function getTags(tagToRemove) {
const tagBadges = document.querySelectorAll('#selected-tags .tag-badge');
return Array.from(tagBadges)
.map(tagBadge => tagBadge.dataset.tag)
const tagElements = document.querySelectorAll('#selected-tags .tag');
return Array.from(tagElements)
.map(tagElement => tagElement.dataset.tag)
.filter(tag => tag !== tagToRemove);
}
@@ -156,7 +156,7 @@ function onTagInputDropdownItemClicked(event) {
*/
function onRemoveTagClicked(event) {
const button = event.currentTarget;
const tag = button.parentElement.dataset.tag;
const tag = button.dataset.tag;
const tags = getTags(tag);
updatePathWithTags(tags);
}
@@ -170,7 +170,7 @@ function onRemoveTagClicked(event) {
* available tags in a searchable dropdown.
*/
document.addEventListener('DOMContentLoaded', function () {
document.querySelectorAll('.remove-tag').forEach(button => {
document.querySelectorAll('.tag').forEach(button => {
button.addEventListener('click', onRemoveTagClicked);
});
+13 -7
View File
@@ -340,6 +340,17 @@ html {
margin-bottom: 1.25rem;
}
/* When an exception's text is shown in message as alert component, don't
overflow the alert's width. */
.alert.d-flex div {
max-width: 100%;
}
/* Tags */
.tag {
--bs-btn-padding-y: 0.25rem; /* Make the badge shorter */
}
/* Tag Input Container */
.tag-input {
display: flex;
@@ -351,17 +362,12 @@ html {
margin-bottom: 2rem;
}
/* When an exception's text is shown in message as alert component, don't
overflow the alert's width. */
.alert.d-flex div {
max-width: 100%;
}
/* Remove tag button */
.tag-badge .remove-tag {
.tag .remove-tag {
background-color: transparent; /* Match the tag's background color */
border: none;
cursor: pointer;
--bs-btn-padding-y: 0; /* To make the entire tag button shorter */
}
/* Adjust input field width */