mirror of
https://github.com/penpot/penpot.git
synced 2025-05-01 04:36:20 +02:00
Add defaults for theme form
This commit is contained in:
parent
84b5be5547
commit
f37cf8be5e
1 changed files with 11 additions and 2 deletions
|
@ -17,7 +17,8 @@
|
||||||
[app.main.ui.workspace.tokens.sets :as wts]
|
[app.main.ui.workspace.tokens.sets :as wts]
|
||||||
[app.main.ui.workspace.tokens.token-set :as wtts]
|
[app.main.ui.workspace.tokens.token-set :as wtts]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]
|
||||||
|
[cuerdas.core :as str]))
|
||||||
|
|
||||||
(def ^:private chevron-icon
|
(def ^:private chevron-icon
|
||||||
(i/icon-xref :arrow (stl/css :chevron-icon)))
|
(i/icon-xref :arrow (stl/css :chevron-icon)))
|
||||||
|
@ -118,7 +119,15 @@
|
||||||
(mf/deps theme-state on-submit)
|
(mf/deps theme-state on-submit)
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(on-submit (:theme @theme-state))
|
(let [theme (:theme @theme-state)
|
||||||
|
final-name (str/trim (:name theme))
|
||||||
|
final-group (-> (:group theme)
|
||||||
|
(str/trim)
|
||||||
|
(str/lower))]
|
||||||
|
(cond-> theme
|
||||||
|
(empty final-name) (assoc :name "Theme")
|
||||||
|
(empty final-group) (dissoc :group)
|
||||||
|
:always on-submit))
|
||||||
(on-back)))]
|
(on-back)))]
|
||||||
[:form {:on-submit on-save-form}
|
[:form {:on-submit on-save-form}
|
||||||
[:div {:class (stl/css :edit-theme-wrapper)}
|
[:div {:class (stl/css :edit-theme-wrapper)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue