mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 13:39:02 +00:00
🐛 Fix id prop on switch component (#8915)
This commit is contained in:
parent
ef39afe9b5
commit
290f37425f
@ -19,6 +19,7 @@
|
|||||||
- Fix title on shared button [Taiga #13730](https://tree.taiga.io/project/penpot/issue/13730)
|
- Fix title on shared button [Taiga #13730](https://tree.taiga.io/project/penpot/issue/13730)
|
||||||
- Fix hover on layers [Taiga #13799](https://tree.taiga.io/project/penpot/issue/13799)
|
- Fix hover on layers [Taiga #13799](https://tree.taiga.io/project/penpot/issue/13799)
|
||||||
- Fix highlight after name edition [Taiga #13783](https://tree.taiga.io/project/penpot/issue/13783)
|
- Fix highlight after name edition [Taiga #13783](https://tree.taiga.io/project/penpot/issue/13783)
|
||||||
|
- Fix id prop on switch component [Taiga #13534](https://tree.taiga.io/project/penpot/issue/13534)
|
||||||
|
|
||||||
|
|
||||||
## 2.14.2
|
## 2.14.2
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
(def ^:private schema:switch
|
(def ^:private schema:switch
|
||||||
[:map
|
[:map
|
||||||
[:id {:optional true} :string]
|
|
||||||
[:class {:optional true} :string]
|
[:class {:optional true} :string]
|
||||||
[:label {:optional true} [:maybe :string]]
|
[:label {:optional true} [:maybe :string]]
|
||||||
[:aria-label {:optional true} [:maybe :string]]
|
[:aria-label {:optional true} [:maybe :string]]
|
||||||
@ -26,10 +25,12 @@
|
|||||||
|
|
||||||
(mf/defc switch*
|
(mf/defc switch*
|
||||||
{::mf/schema schema:switch}
|
{::mf/schema schema:switch}
|
||||||
[{:keys [id class label aria-label default-checked on-change disabled] :rest props} ref]
|
[{:keys [class label aria-label default-checked on-change disabled] :rest props} ref]
|
||||||
(let [checked* (mf/use-state default-checked)
|
(let [checked* (mf/use-state default-checked)
|
||||||
checked? (deref checked*)
|
checked? (deref checked*)
|
||||||
|
|
||||||
|
id (mf/use-id)
|
||||||
|
|
||||||
disabled? (d/nilv disabled false)
|
disabled? (d/nilv disabled false)
|
||||||
|
|
||||||
has-label? (not (str/blank? label))
|
has-label? (not (str/blank? label))
|
||||||
|
|||||||
@ -114,8 +114,7 @@
|
|||||||
:class (stl/css :theme-row)}
|
:class (stl/css :theme-row)}
|
||||||
[:div {:class (stl/css :theme-switch-row)}
|
[:div {:class (stl/css :theme-switch-row)}
|
||||||
|
|
||||||
[:> switch* {:id name
|
[:> switch* {:label name
|
||||||
:label name
|
|
||||||
:on-change on-switch-theme
|
:on-change on-switch-theme
|
||||||
:default-checked selected?}]]
|
:default-checked selected?}]]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user