0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 12:59:12 -05:00

🐛 Fix problems with data-value keyword

This commit is contained in:
alonso.torres 2024-01-11 15:45:12 +01:00 committed by Andrey Antukh
parent 189d0c107c
commit 6ef85ef0e8
18 changed files with 57 additions and 53 deletions

View file

@ -57,8 +57,10 @@
(mf/deps exports)
(fn [event]
(let [index (-> (dom/get-current-target event)
(dom/get-data "value"))]
(swap! exports update-in [index :enabled] not))))
(dom/get-data "value")
(d/parse-integer))]
(when (some? index)
(swap! exports update-in [index :enabled] not)))))
change-all
(fn [_]
@ -104,7 +106,7 @@
[:div {:class (stl/css :selection-row)
:key (:id shape)}
[:button {:class (stl/css :selection-btn)
:data-value index
:data-value (str index)
:on-click on-toggle-enabled}
[:span {:class (stl/css :checkbox-wrapper)}
(if (:enabled export)

View file

@ -126,6 +126,7 @@
}
.selection-title {
@include titleTipography;
color: $df-primary;
}
}
.selection-wrapper {

View file

@ -56,8 +56,7 @@
(fn [event]
(let [mode (-> (dom/get-target event)
(dom/get-data "value")
(boolean))
_ (prn mode)]
(boolean))]
(st/emit! (dcm/update-options {:show-sidebar? (not mode)})))))]
[:div {:class (stl/css :view-options)
@ -71,7 +70,7 @@
[:ul {:class (stl/css :dropdown)}
[:li {:class (stl/css-case :dropdown-element true
:selected (or (= :all cmode) (nil? cmode)))
:data-value :all
:data-value "all"
:on-click update-mode}
[:span {:class (stl/css :label)} (tr "labels.show-all-comments")]
@ -80,7 +79,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected (= :yours cmode))
:data-value :yours
:data-value "yours"
:on-click update-mode}
[:span {:class (stl/css :label)}
@ -94,7 +93,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected (= :pending cshow))
:data-value (if (= :pending cshow) :all :pending)
:data-value (if (= :pending cshow) "all" "pending")
:on-click update-show}
[:span {:class (stl/css :label)}
@ -107,7 +106,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected show-sidebar?)
:data-value show-sidebar?
:data-value (str show-sidebar?)
:on-click update-options}
[:span {:class (stl/css :label)} (tr "labels.show-comments-list")]

View file

@ -302,7 +302,7 @@
[:div {:class (stl/css :mode-zone)}
[:button {:on-click navigate
:data-value :interactions
:data-value "interactions"
:class (stl/css-case :mode-zone-btn true
:selected (= section :interactions))
:title (tr "viewer.header.interactions-section" (sc/get-tooltip :open-interactions))}
@ -311,7 +311,7 @@
(when (or (:can-edit permissions)
(= (:who-comment permissions) "all"))
[:button {:on-click navigate
:data-value :comments
:data-value "comments"
:class (stl/css-case :mode-zone-btn true
:selected (= section :comments))
:title (tr "viewer.header.comments-section" (sc/get-tooltip :open-comments))}

View file

@ -258,7 +258,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected (= interactions-mode :hide))
:on-click select-mode
:data-mode :hide}
:data-mode "hide"}
[:span {:class (stl/css :label)} (tr "viewer.header.dont-show-interactions")]
(when (= interactions-mode :hide)
@ -267,7 +267,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected (= interactions-mode :show))
:on-click select-mode
:data-mode :show}
:data-mode "show"}
[:span {:class (stl/css :label)} (tr "viewer.header.show-interactions")]
(when (= interactions-mode :show)
[:span {:class (stl/css :icon)} i/tick-refactor])]
@ -277,7 +277,7 @@
[:li {:class (stl/css-case :dropdown-element true
:selected (= interactions-mode :show-on-click))
:on-click select-mode
:data-mode :show-on-click}
:data-mode "show-on-click"}
[:span {:class (stl/css :label)} (tr "viewer.header.show-interactions-on-click")]
(when (= interactions-mode :show-on-click)

View file

@ -86,12 +86,12 @@
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:a {:on-click set-section
:data-value :recovery-request}
:data-value "recovery-request"}
(tr "auth.forgot-password")]]
[:div {:class (stl/css :link-entry)}
[:span (tr "auth.register") " "]
[:a {:on-click set-section
:data-value :register}
:data-value "register"}
(tr "auth.register-submit")]]]]
:register
@ -101,7 +101,7 @@
[:div {:class (stl/css :link-entry)}
[:span (tr "auth.already-have-account") " "]
[:a {:on-click set-section
:data-value :login}
:data-value "login"}
(tr "auth.login-here")]]]]
:register-validate
@ -111,7 +111,7 @@
[:div {:class (stl/css :links)}
[:div {:class (stl/css :link-entry)}
[:a {:on-click set-section
:data-value :register}
:data-value "register"}
(tr "labels.go-back")]]]]
:recovery-request

View file

@ -139,7 +139,7 @@
(fn [event]
(let [offset (-> (dom/get-current-target event)
(dom/get-data "value")
(int))]
(d/parse-integer))]
(st/emit! (dc/select-colorpicker-gradient-stop offset)))))
on-select-library-color

View file

@ -30,7 +30,7 @@
(for [{:keys [offset hex r g b alpha] :as value} stops]
[:button {:class (stl/css-case :gradient-stop true
:selected (= editing-stop offset))
:data-value offset
:data-value (str offset)
:on-click on-select-stop
:style {:left (dm/str (* offset 100) "%")
:backgroundColor hex}

View file

@ -36,7 +36,8 @@
(defn calculate-palette-padding [rulers?]
(let [left-sidebar (dom/get-element "left-sidebar-aside")
left-sidebar-size (d/parse-integer (dom/get-data left-sidebar "size"))
left-sidebar-size (-> (dom/get-data left-sidebar "size")
(d/parse-integer))
rulers-width (if rulers? 22 0)
min-left-sidebar-width 275
left-padding 4

View file

@ -59,7 +59,7 @@
[:aside {:ref parent-ref
:id "left-sidebar-aside"
:data-size size
:data-size (str size)
:class (stl/css-case :left-settings-bar true
:global/two-row (<= size 300)
:global/three-row (and (> size 300) (<= size 400))
@ -153,7 +153,7 @@
:expanded (> size 276))
:id "right-sidebar-aside"
:data-size size
:data-size (str size)
:style #js {"--width" (when can-be-expanded? (dm/str size "px"))}}
(when can-be-expanded?
[:div {:class (stl/css :resize-area)

View file

@ -18,7 +18,7 @@
[]
(let [on-click (mf/use-fn #(st/emit! (dw/toggle-layout-flag :collapse-left-sidebar)))]
[:div {:id "left-sidebar-aside"
:data-size 0
:data-size "0"
:class (stl/css :collapsed-sidebar)}
[:div {:class (stl/css :collapsed-title)}
[:button {:class (stl/css :collapsed-button)

View file

@ -48,7 +48,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.hleft" (sc/get-tooltip :align-left))
:data-value :hleft
:data-value "hleft"
:on-click align-objects}
i/align-left-refactor]
@ -56,7 +56,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.hcenter" (sc/get-tooltip :align-hcenter))
:data-value :hcenter
:data-value "hcenter"
:on-click align-objects}
i/align-horizontal-center-refactor]
@ -64,7 +64,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.hright" (sc/get-tooltip :align-right))
:data-value :hright
:data-value "hright"
:on-click align-objects}
i/align-right-refactor]
@ -72,7 +72,7 @@
:disabled disabled-distribute)
:disabled disabled-distribute
:title (tr "workspace.align.hdistribute" (sc/get-tooltip :h-distribute))
:data-value :horizontal
:data-value "horizontal"
:on-click distribute-objects}
i/distribute-horizontally-refactor]]
@ -81,7 +81,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.vtop" (sc/get-tooltip :align-top))
:data-value :vtop
:data-value "vtop"
:on-click align-objects}
i/align-top-refactor]
@ -89,7 +89,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.vcenter" (sc/get-tooltip :align-vcenter))
:data-value :vcenter
:data-value "vcenter"
:on-click align-objects}
i/align-vertical-center-refactor]
@ -97,7 +97,7 @@
:disabled disabled-align)
:disabled disabled-align
:title (tr "workspace.align.vbottom" (sc/get-tooltip :align-bottom))
:data-value :vbottom
:data-value "vbottom"
:on-click align-objects}
i/align-bottom-refactor]
@ -105,7 +105,7 @@
:class (stl/css-case :align-button true
:disabled disabled-distribute)
:disabled disabled-distribute
:data-value :vertical
:data-value "vertical"
:on-click distribute-objects}
i/distribute-vertical-spacing-refactor]]])))

View file

@ -168,7 +168,7 @@
[:button {:class (stl/css-case :constraint-btn true
:active (or (= constraints-v :top)
(= constraints-v :topbottom)))
:data-value :top
:data-value "top"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]]
[:div {:class (stl/css :constraints-left)}
@ -176,19 +176,19 @@
:constraint-btn-rotated true
:active (or (= constraints-h :left)
(= constraints-h :leftright)))
:data-value :left
:data-value "left"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]]
[:div {:class (stl/css :constraints-center)}
[:button {:class (stl/css-case :constraint-btn true
:active (= constraints-h :center))
:data-value :centerh
:data-value "centerh"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]
[:button {:class (stl/css-case :constraint-btn-special true
:constraint-btn-rotated true
:active (= constraints-v :center))
:data-value :centerv
:data-value "centerv"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]]
[:div {:class (stl/css :constraints-right)}
@ -196,14 +196,14 @@
:constraint-btn-rotated true
:active (or (= constraints-h :right)
(= constraints-h :leftright)))
:data-value :right
:data-value "right"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]]
[:div {:class (stl/css :constraints-bottom)}
[:button {:class (stl/css-case :constraint-btn true
:active (or (= constraints-v :bottom)
(= constraints-v :topbottom)))
:data-value :bottom
:data-value "bottom"
:on-click on-constraint-button-clicked}
[:span {:class (stl/css :resalted-area)}]]]]
[:div {:class (stl/css :contraints-selects)}

View file

@ -128,7 +128,7 @@
(let [value (dom/get-target-val event)
index (-> (dom/get-current-target event)
(dom/get-data "value")
(int))]
(d/parse-integer))]
(st/emit! (dch/update-shapes ids
(fn [shape]
(assoc-in shape [:exports index :suffix] value)))))))
@ -216,7 +216,7 @@
:type "text"
:value (:suffix export)
:placeholder (tr "workspace.options.export.suffix")
:data-value index
:data-value (str index)
:on-change on-suffix-change
:on-key-down manage-key-down}]]]

View file

@ -518,57 +518,57 @@
[:button {:class (stl/css-case :direction-btn true
:center-btn true
:active (= overlay-pos-type :center))
:data-value :center
:data-value "center"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:top-left-btn true
:active (= overlay-pos-type :top-left))
:data-value :top-left
:data-value "top-left"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:top-right-btn true
:active (= overlay-pos-type :top-right))
:data-value :top-right
:data-value "top-right"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:top-center-btn true
:active (= overlay-pos-type :top-center))
:data-value :top-center
:data-value "top-center"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:bottom-left-btn true
:active (= overlay-pos-type :bottom-left))
:data-value :bottom-left
:data-value "bottom-left"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:bottom-left-btn true
:active (= overlay-pos-type :bottom-left))
:data-value :bottom-left
:data-value "bottom-left"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:bottom-left-btn true
:active (= overlay-pos-type :bottom-left))
:data-value :bottom-left
:data-value "bottom-left"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:bottom-right-btn true
:active (= overlay-pos-type :bottom-right))
:data-value :bottom-right
:data-value "bottom-right"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]
[:button {:class (stl/css-case :direction-btn true
:bottom-center-btn true
:active (= overlay-pos-type :bottom-center))
:data-value :bottom-center
:data-value "bottom-center"
:on-click toggle-overlay-pos-type}
[:span {:class (stl/css :rectangle)}]]]]

View file

@ -930,7 +930,7 @@
[:button {:class (stl/css :layout-option) :on-click set-grid} "Grid layout"]]]]
[:button {:class (stl/css :add-layout)
:data-value :flex
:data-value "flex"
:on-click on-set-layout}
i/add-refactor])
[:button {:class (stl/css :remove-layout)

View file

@ -365,8 +365,8 @@
[:li {:key (:name size-preset)
:class (stl/css-case :dropdown-element true
:match preset-match)
:data-width (:width size-preset)
:data-height (:height size-preset)
:data-width (str (:width size-preset))
:data-height (str (:height size-preset))
:on-click on-preset-selected}
[:div {:class (stl/css :name-wrapper)}
[:span {:class (stl/css :preset-name)} (:name size-preset)]

View file

@ -462,7 +462,8 @@
(when (dom/left-mouse? event)
(dom/stop-propagation event)
(let [target (dom/get-current-target event)
position (keyword (dom/get-data target "position"))]
position (-> (dom/get-data target "position")
(keyword))]
(st/emit! (dw/start-resize position #{shape-id} shape))))))
on-rotate