diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs index d99e9dcac..e6ee5df1a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets/common.cljs @@ -130,7 +130,7 @@ (mf/defc asset-section {::mf/wrap-props false} - [{:keys [children file-id title section assets-count open?]}] + [{:keys [children file-id title section assets-count icon open?]}] (let [children (-> (array/normalize-to-array children) (array/without-nils)) @@ -151,7 +151,7 @@ (mf/html [:span {:class (stl/css :title-name)} [:span {:class (stl/css :section-icon)} - [:& section-icon {:section section}]] + [:& (or icon section-icon) {:section section}]] [:span {:class (stl/css :section-name)} title] diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs index 3926ed056..e43b59d37 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs @@ -31,10 +31,28 @@ :on-click on-click} name])) +(mf/defc token-section-icon + {::mf/wrap-props false} + [{:keys [type]}] + (case type + :border-radius i/corner-radius + :numeric [:span {:class (stl/css :section-text-icon)} "123"] + :boolean i/boolean-difference + :opacity [:span {:class (stl/css :section-text-icon)} "%"] + :rotation i/rotation + :spacing i/padding-extended + :string i/text-mixed + :stroke-width i/stroke-size + :typography i/text + ;; TODO: Add diagonal icon here when it's available + :dimension [:div {:style {:rotate "45deg"}} i/constraint-horizontal] + :sizing [:div {:style {:rotate "45deg"}} i/constraint-horizontal] + i/add)) + (mf/defc token-component [{:keys [type file tokens selected-shapes token-type-props]}] (let [open? (mf/use-state false) - {:keys [modal attributes title]} token-type-props + {:keys [icon modal attributes title]} token-type-props on-toggle-open-click (mf/use-fn (mf/deps open? tokens) #(when (seq tokens) @@ -59,6 +77,8 @@ tokens-count (count tokens)] [:div {:on-click on-toggle-open-click} [:& cmm/asset-section {:file-id (:id file) + :icon (mf/fnc icon-wrapper [_] + [:& token-section-icon {:type type}]) :title title :assets-count tokens-count :open? @open?} diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.scss b/frontend/src/app/main/ui/workspace/tokens/sidebar.scss index bdc412252..36593a70d 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.scss +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.scss @@ -34,3 +34,11 @@ opacity: 0.8; } } + +.section-text-icon { + font-size: $fs-12; + width: 16px; + height: 16px; + display: flex; + place-content: center; +}