Skip to content

Commit

Permalink
Improve appearance of remove/undo buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
huntertur committed Dec 27, 2024
1 parent b5983a8 commit b2de552
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions assets/js/edit-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function markEntryForRemoval() {
});

this.textContent = 'πŸ”„';
this.ariaLabel = 'Undo';
this.className.replace('negative', 'positive');
this.removeEventListener('click', markEntryForRemoval);
this.addEventListener('click', unmarkEntryForRemoval);
Expand All @@ -35,7 +36,8 @@ function unmarkEntryForRemoval() {
element.disabled = false;
});

this.textContent = 'πŸ—‘';
this.textContent = '❌';
this.ariaLabel = 'Remove';
this.className.replace('positive', 'negative');
this.removeEventListener('click', unmarkEntryForRemoval);
this.addEventListener('click', markEntryForRemoval);
Expand Down Expand Up @@ -68,7 +70,9 @@ function addNewSocialGroupIfNeeded() {

newSocialGroup.addEventListener('input', addNewSocialGroupIfNeeded);

document.querySelectorAll('tr:not(#new-social-group) .remove-contact').forEach(element => {
document.querySelector('th.remove-contact').hidden = false;

document.querySelectorAll('tr:not(#new-social-group) td.remove-contact').forEach(element => {
element.hidden = false;
element.firstChild.addEventListener('click', markEntryForRemoval);
});
Expand Down
6 changes: 3 additions & 3 deletions weasyl/templates/control/edit_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ <h3>Contact and Social Media</h3>
<th id="site-name-header" class="site-name">Site name</th>
<th id="site-label-header" class="site-label">Label (optional)</th>
<th id="site-value-header">Username or URL</th>
<th class="remove-contact" hidden>πŸ—‘</th>
<th class="remove-contact" hidden aria-label="Actions"></th>
</tr>
</thead>
<tbody>
Expand All @@ -147,13 +147,13 @@ <h3>Contact and Social Media</h3>
<td class="site-name"><input is="weasyl-combobox" type="text" class="input" name="site_names" value="${site}" placeholder="Site name" list="known-social-sites" aria-labelledby="site-name-header"></td>
<td class="site-label"><input type="text" class="input" name="site_labels" value="${label}" placeholder="✏️ Label" aria-labelledby="site-label-header"></td>
<td><input type="text" class="input" name="site_values" value="${value}" placeholder="Username or URL" aria-labelledby="site-label-header"></td>
<td class="remove-contact" hidden><button class="button negative" type="button">πŸ—‘</button></td>
<td class="remove-contact" hidden><button class="button negative" type="button" aria-label="Remove">❌</button></td>
</tr>
<tr id="new-social-group">
<td class="site-name"><input is="weasyl-combobox" type="text" class="input" name="site_names" placeholder="Site name" list="known-social-sites" aria-labelledby="site-name-header"></td>
<td class="site-label"><input type="text" class="input" name="site_labels" placeholder="✏️ Label" aria-labelledby="site-label-header"></td>
<td><input type="text" class="input" name="site_values" placeholder="Username or URL" aria-labelledby="site-value-header"></td>
<td class="remove-contact" hidden><button class="button negative" type="button">πŸ—‘</button></td>
<td class="remove-contact" hidden><button class="button negative" type="button" aria-label="Remove">❌</button></td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit b2de552

Please sign in to comment.