mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05:00
Show themes
This commit is contained in:
parent
62712ef8da
commit
e502def755
2 changed files with 31 additions and 16 deletions
|
@ -240,6 +240,9 @@
|
||||||
st/state
|
st/state
|
||||||
=))
|
=))
|
||||||
|
|
||||||
|
(def workspace-active-theme-ids
|
||||||
|
(l/derived wtts/get-active-theme-ids st/state))
|
||||||
|
|
||||||
(def workspace-active-theme-id
|
(def workspace-active-theme-id
|
||||||
(l/derived wtts/update-theme-id st/state))
|
(l/derived wtts/update-theme-id st/state))
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,8 @@
|
||||||
|
|
||||||
(mf/defc token-sets
|
(mf/defc token-sets
|
||||||
[_props]
|
[_props]
|
||||||
(let [selected-theme-id (mf/deref refs/workspace-active-theme-id)
|
(let [active-theme-ids (mf/deref refs/workspace-active-theme-ids)
|
||||||
|
selected-theme-id (mf/deref refs/workspace-active-theme-id)
|
||||||
themes (mf/deref refs/workspace-ordered-token-themes)
|
themes (mf/deref refs/workspace-ordered-token-themes)
|
||||||
themes-index (mf/deref refs/workspace-token-themes)
|
themes-index (mf/deref refs/workspace-token-themes)
|
||||||
selected-theme (get themes-index selected-theme-id)
|
selected-theme (get themes-index selected-theme-id)
|
||||||
|
@ -177,7 +178,7 @@
|
||||||
[:style
|
[:style
|
||||||
(str "@scope {"
|
(str "@scope {"
|
||||||
(str/join "\n"
|
(str/join "\n"
|
||||||
["ul { list-style-type: disk; margin-left: 20px; }"
|
["ul { list-style-type: circle; margin-left: 20px; }"
|
||||||
".spaced { display: flex; gap: 10px; justify-content: space-between; }"
|
".spaced { display: flex; gap: 10px; justify-content: space-between; }"
|
||||||
".spaced-y { display: flex; flex-direction: column; gap: 10px }"
|
".spaced-y { display: flex; flex-direction: column; gap: 10px }"
|
||||||
".selected { font-weight: 600; }"
|
".selected { font-weight: 600; }"
|
||||||
|
@ -190,17 +191,30 @@
|
||||||
:padding "10px"
|
:padding "10px"
|
||||||
:margin-bottom "50px"}}
|
:margin-bottom "50px"}}
|
||||||
|
|
||||||
[:ul
|
[:& tokene-theme-create]
|
||||||
[:& tokene-theme-create]
|
[:div.spaced-y
|
||||||
(for [[group themes] themes]
|
[:b "Themes"]
|
||||||
[:li
|
[:ul
|
||||||
{:key (str "token-theme-group" group)}
|
(for [[group themes] themes]
|
||||||
group
|
[:li
|
||||||
#_[:ul
|
{:key (str "token-theme-group" group)}
|
||||||
(for [{:keys [id] :as theme} themes]
|
group
|
||||||
[:li {:key (str "tokene-theme-" id)}
|
[:ul
|
||||||
[:input {:type "checkbox"
|
(for [{:keys [id name] :as theme} themes]
|
||||||
:checked (wtts/theme-selected? theme)}]])]])]
|
[:li {:key (str "tokene-theme-" id)}
|
||||||
|
[:div.spaced
|
||||||
|
name
|
||||||
|
[:div.spaced
|
||||||
|
[:button
|
||||||
|
{:on-click (fn [e]
|
||||||
|
(dom/prevent-default e)
|
||||||
|
(dom/stop-propagation e))}
|
||||||
|
(if (some-> active-theme-ids (get id)) "✅" "❎")]
|
||||||
|
[:button {:on-click (fn [e]
|
||||||
|
(dom/prevent-default e)
|
||||||
|
(dom/stop-propagation e)
|
||||||
|
(st/emit! (wdt/delete-token-set id)))}
|
||||||
|
"🗑️"]]]])]])]]
|
||||||
[:div.spaced
|
[:div.spaced
|
||||||
[:b "Sets"]
|
[:b "Sets"]
|
||||||
[:button {:on-click #(st/emit! (wdt/create-token-set nil))} "Create"]]
|
[:button {:on-click #(st/emit! (wdt/create-token-set nil))} "Create"]]
|
||||||
|
@ -219,9 +233,7 @@
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(dom/stop-propagation e)
|
(dom/stop-propagation e)
|
||||||
(st/emit! (wdt/toggle-token-set id)))}
|
(st/emit! (wdt/toggle-token-set id)))}
|
||||||
(if (wtts/token-set-enabled-in-theme? id selected-theme)
|
(when (wtts/token-set-enabled-in-theme? id selected-theme) "👁️")]
|
||||||
"👁️"
|
|
||||||
"")]
|
|
||||||
[:button {:on-click (fn [e]
|
[:button {:on-click (fn [e]
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(dom/stop-propagation e)
|
(dom/stop-propagation e)
|
||||||
|
|
Loading…
Add table
Reference in a new issue