From daf56bf124170fa02003a34e9b9507c1e608aab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Sat, 28 Dec 2024 08:05:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9Switch=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E8=AE=B0=E5=BD=95disabled=E7=8A=B6=E6=80=81=E7=9A=84?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Switch.module.css | 4 ++-- src/components/Switch.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Switch.module.css b/src/components/Switch.module.css index 8433c91..775803e 100644 --- a/src/components/Switch.module.css +++ b/src/components/Switch.module.css @@ -4,7 +4,7 @@ align-items: center; gap: 1em; cursor: pointer; - &[aria-disabled] { + &[disabled] { cursor: not-allowed; } } @@ -31,7 +31,7 @@ transform: translate(calc(var(--spacing) * 10 - 1px), 2px); } } - [aria-disabled] & { + [disabled] & { --disabled-background: oklch( from var(--color-primary-disabled) calc(l * 0.5) calc(c * 0.5) h ); diff --git a/src/components/Switch.tsx b/src/components/Switch.tsx index 73f1d61..2ac3422 100644 --- a/src/components/Switch.tsx +++ b/src/components/Switch.tsx @@ -25,7 +25,7 @@ export function Switch({ checked = false, disabled = false, onChange }: SwitchPr }, [checked]); return ( -
+