From 0d2d1a8b8a6609a8965c360e05b6d6f6ac93e86f Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Mon, 26 Aug 2024 16:23:23 +0200 Subject: [PATCH] Link up actions --- .../main/ui/workspace/tokens/theme_select.cljs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/theme_select.cljs b/frontend/src/app/main/ui/workspace/tokens/theme_select.cljs index ff8ed5b7e..7b97f0588 100644 --- a/frontend/src/app/main/ui/workspace/tokens/theme_select.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/theme_select.cljs @@ -8,13 +8,17 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.uuid :as uuid] + [app.main.data.modal :as modal] + [app.main.data.tokens :as wdt] [app.main.refs :as refs] + [app.main.store :as st] [app.main.ui.components.dropdown :refer [dropdown]] [app.main.ui.icons :as i] + [app.util.dom :as dom] [rumext.v2 :as mf])) (mf/defc theme-options - [{:keys []}] + [{:keys [on-close]}] (let [active-theme-ids (mf/deref refs/workspace-active-theme-ids) ordered-themes (mf/deref refs/workspace-ordered-token-themes)] [:ul @@ -29,11 +33,16 @@ :class (stl/css-case :checked-element true :sub-item true - :is-selected selected?)} + :is-selected selected?) + :on-click (fn [e] + (dom/stop-propagation e) + (st/emit! (wdt/toggle-token-theme id)) + (on-close))} [:span {:class (stl/css :label)} name] [:span {:class (stl/css :check-icon)} i/tick]])]]) [:li {:class (stl/css-case :checked-element true - :checked-element-button true)} + :checked-element-button true) + :on-click #(modal/show! :tokens/themes {})} [:span "Edit themes"] [:span {:class (stl/css :icon)} i/arrow]]])) @@ -70,4 +79,4 @@ [:& dropdown {:show is-open? :on-close on-close-dropdown} [:div {:ref dropdown-element* :class (stl/css :custom-select-dropdown)} - [:& theme-options]]]])) + [:& theme-options {:on-close on-close-dropdown}]]]]))