From cd70d80795185f144d1407f936b13762073221bd Mon Sep 17 00:00:00 2001 From: kandrelczyk Date: Sat, 2 Dec 2023 18:15:03 +0100 Subject: [PATCH] Proper handling of disabled buttons (#32) * Proper handling of disabled buttons * Proper handling of disabled buttons * Proper handling of disabled buttons --------- Co-authored-by: Cristobal Andrada --- src/button/button.css | 14 +++++++++++--- src/button/mod.rs | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/button/button.css b/src/button/button.css index 34ac08e..8171afc 100644 --- a/src/button/button.css +++ b/src/button/button.css @@ -12,7 +12,7 @@ user-select: none; } -.thaw-button:hover { +.thaw-button:hover:not(.thaw-button--disabled) { border-color: var(--thaw-border-color-hover); background-color: var(--thaw-background-color-hover); cursor: pointer; @@ -20,6 +20,10 @@ transition: all 0.3s; } +.thaw-button--disabled:not(.thaw-button--text) { + cursor: not-allowed; +} + .thaw-button:active:not(.thaw-button--disabled) { transition: all 0.3s; border-color: var(--thaw-border-color-hover); @@ -31,16 +35,20 @@ border: none; } -.thaw-button--text:hover { +.thaw-button--text:hover:not(.thaw-button--disabled) { color: var(--thaw-font-color-hover); } +.thaw-button--text.thaw-button--disabled { + cursor: not-allowed; +} + .thaw-button--link { height: auto; padding: inherit; } -.thaw-button--link:hover { +.thaw-button--link:hover:not(.thaw-button--disabled) { color: var(--thaw-font-color-hover); } diff --git a/src/button/mod.rs b/src/button/mod.rs index c7179b0..e2c2848 100644 --- a/src/button/mod.rs +++ b/src/button/mod.rs @@ -144,6 +144,7 @@ pub fn Button( class=("thaw-button--round", move || round.get()) class=("thaw-button--disabled", move || disabled.get()) style=move || format!("{}{}", css_vars.get(), style.get()) + disabled=move || disabled.get() on:click=on_click >