mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 08:56:10 +02:00
⚡ Optimize the element-behaviour-horizontal
react component
This commit is contained in:
parent
710a357a6e
commit
c7582e7887
1 changed files with 9 additions and 8 deletions
|
@ -220,11 +220,12 @@
|
||||||
i/margin-refactor]]))
|
i/margin-refactor]]))
|
||||||
|
|
||||||
(mf/defc element-behaviour-horizontal
|
(mf/defc element-behaviour-horizontal
|
||||||
[{:keys [auto? fill? layout-item-sizing on-change] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [^boolean auto ^boolean fill layout-item-sizing on-change]}]
|
||||||
[:div {:class (stl/css-case :horizontal-behaviour true
|
[:div {:class (stl/css-case :horizontal-behaviour true
|
||||||
:one-element (and (not fill?) (not auto?))
|
:one-element (and (not fill) (not auto))
|
||||||
:two-element (or fill? auto?)
|
:two-element (or fill auto)
|
||||||
:three-element (and fill? auto?))}
|
:three-element (and fill auto))}
|
||||||
[:& radio-buttons {:selected (d/name layout-item-sizing)
|
[:& radio-buttons {:selected (d/name layout-item-sizing)
|
||||||
:on-change on-change
|
:on-change on-change
|
||||||
:wide true
|
:wide true
|
||||||
|
@ -233,12 +234,12 @@
|
||||||
:icon i/fixed-width-refactor
|
:icon i/fixed-width-refactor
|
||||||
:title "Fix width"
|
:title "Fix width"
|
||||||
:id "behaviour-h-fix"}]
|
:id "behaviour-h-fix"}]
|
||||||
(when fill?
|
(when fill
|
||||||
[:& radio-button {:value "fill"
|
[:& radio-button {:value "fill"
|
||||||
:icon i/fill-content-refactor
|
:icon i/fill-content-refactor
|
||||||
:title "Width 100%"
|
:title "Width 100%"
|
||||||
:id "behaviour-h-fill"}])
|
:id "behaviour-h-fill"}])
|
||||||
(when auto?
|
(when auto
|
||||||
[:& radio-button {:value "auto"
|
[:& radio-button {:value "auto"
|
||||||
:icon i/hug-content-refactor
|
:icon i/hug-content-refactor
|
||||||
:title "Fit content"
|
:title "Fit content"
|
||||||
|
@ -281,8 +282,8 @@
|
||||||
on-change-behaviour-v-refactor] :as props}]
|
on-change-behaviour-v-refactor] :as props}]
|
||||||
[:div {:class (stl/css-case :behaviour-menu true
|
[:div {:class (stl/css-case :behaviour-menu true
|
||||||
:wrap (and fill? auto?))}
|
:wrap (and fill? auto?))}
|
||||||
[:& element-behaviour-horizontal {:auto? auto?
|
[:& element-behaviour-horizontal {:auto auto?
|
||||||
:fill? fill?
|
:fill fill?
|
||||||
:layout-item-sizing layout-item-h-sizing
|
:layout-item-sizing layout-item-h-sizing
|
||||||
:on-change on-change-behaviour-h-refactor}]
|
:on-change on-change-behaviour-h-refactor}]
|
||||||
[:& element-behaviour-vertical {:auto? auto?
|
[:& element-behaviour-vertical {:auto? auto?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue