0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Optimize the align-self-row react component

This commit is contained in:
Andrey Antukh 2024-02-16 11:39:17 +01:00
parent 71681532cd
commit 46fca11b38

View file

@ -293,21 +293,22 @@
:on-change on-change-behaviour-v-refactor}]]) :on-change on-change-behaviour-v-refactor}]])
(mf/defc align-self-row (mf/defc align-self-row
[{:keys [is-col? align-self on-change] :as props}] {::mf/props :obj}
[{:keys [^boolean is-col align-self on-change]}]
[:& radio-buttons {:selected (d/name align-self) [:& radio-buttons {:selected (d/name align-self)
:on-change on-change :on-change on-change
:name "flex-align-self" :name "flex-align-self"
:allow-empty true} :allow-empty true}
[:& radio-button {:value "start" [:& radio-button {:value "start"
:icon (get-layout-flex-icon :align-self :start is-col?) :icon (get-layout-flex-icon :align-self :start is-col)
:title "Align self start" :title "Align self start"
:id "align-self-start"}] :id "align-self-start"}]
[:& radio-button {:value "center" [:& radio-button {:value "center"
:icon (get-layout-flex-icon :align-self :center is-col?) :icon (get-layout-flex-icon :align-self :center is-col)
:title "Align self center" :title "Align self center"
:id "align-self-center"}] :id "align-self-center"}]
[:& radio-button {:value "end" [:& radio-button {:value "end"
:icon (get-layout-flex-icon :align-self :end is-col?) :icon (get-layout-flex-icon :align-self :end is-col)
:title "Align self end" :title "Align self end"
:id "align-self-end"}]]) :id "align-self-end"}]])
@ -478,7 +479,7 @@
(when (and is-layout-child? is-flex-parent?) (when (and is-layout-child? is-flex-parent?)
[:div {:class (stl/css :row)} [:div {:class (stl/css :row)}
[:& align-self-row {:is-col? is-col? [:& align-self-row {:is-col is-col?
:align-self align-self :align-self align-self
:on-change set-align-self}]]) :on-change set-align-self}]])