Skip to content

Commit

Permalink
refactor(radio button): simplify CSS selector
Browse files Browse the repository at this point in the history
Based on @MRita443 's suggestion, add class 'selected' to the label when hovered.

Co-Authored-By: Rita Lopes <93883163+MRita443@users.noreply.github.com>
  • Loading branch information
tomas-sucena and MRita443 committed Dec 4, 2024
1 parent d8fb00a commit d14c25c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/forms/radio-buttons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
/>
<label
class="m-1 justify-self-start rounded-lg bg-taupe-200 px-5 py-1 text-rose-950"
class:selected={selectedOption === option}
for="radio-{option}"
>
{option}
</label>
{/each}
</div>
</fieldset>

<style>
.radio-button:checked + label {
label.selected {
background-color: theme('colors.muted-red.400');
color: theme('colors.taupe.100');
}
Expand Down

0 comments on commit d14c25c

Please sign in to comment.