add input measures

This commit is contained in:
elhombretecla 2016-11-04 13:32:03 +01:00 committed by Andrey Antukh
parent 9d196e7c9f
commit c8ebc7ea87
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
10 changed files with 265 additions and 192 deletions

View file

@ -312,6 +312,56 @@ ul.slider-dots {
} }
// Input elements // Input elements
.input-element {
display: flex;
position: relative;
width: 100%;
&::after {
color: $soft-ui-text;
font-size: $fs12;
height: 20px;
position: absolute;
right: 3px;
top: 26%;
width: 20px;
}
// Input amounts
&.pixels {
&::after {
content: "px";
}
}
&.percentail {
&::after {
content: "%";
}
}
&.miliseconds {
&::after {
content: "ms";
}
}
&.degrees {
&::after {
content: "dg";
}
}
}
input, input,
select { select {
@ -355,6 +405,7 @@ input[type="checkbox"]:focus {
box-shadow: none; box-shadow: none;
outline: none; outline: none;
padding: $small $big $small $small; padding: $small $big $small $small;
position: relative;
@include placeholder { @include placeholder {
transition: all .3s ease; transition: all .3s ease;
@ -402,6 +453,7 @@ input[type="checkbox"]:focus {
} }
// Input radio // Input radio
.input-radio, .input-radio,

View file

@ -55,7 +55,8 @@
width: 100%; width: 100%;
.input-text { .input-text {
width: 35%; margin-right: $small;
// width: 35%;
} }
.toggle-layout { .toggle-layout {

View file

@ -63,22 +63,24 @@
[:form {:on-submit on-submit} [:form {:on-submit on-submit}
[:span.lightbox-label "Grid size"] [:span.lightbox-label "Grid size"]
[:div.project-size [:div.project-size
[:div.input-element.pixels
[:input#grid-x.input-text [:input#grid-x.input-text
{:placeholder "X px" {:placeholder "X"
:type "number" :type "number"
:class (forms/error-class errors :grid/x-axis) :class (forms/error-class errors :grid/x-axis)
:value (:grid/x-axis form "") :value (:grid/x-axis form "")
:on-change (partial on-field-change :grid/x-axis) :on-change (partial on-field-change :grid/x-axis)
:min 1 :min 1
:max 100}] :max 100}]]
[:div.input-element.pixels
[:input#grid-y.input-text [:input#grid-y.input-text
{:placeholder "Y px" {:placeholder "Y"
:type "number" :type "number"
:class (forms/error-class errors :grid/y-axis) :class (forms/error-class errors :grid/y-axis)
:value (:grid/y-axis form "") :value (:grid/y-axis form "")
:on-change (partial on-field-change :grid/y-axis) :on-change (partial on-field-change :grid/y-axis)
:min 1 :min 1
:max 100}]] :max 100}]]]
[:span.lightbox-label "Grid color"] [:span.lightbox-label "Grid color"]
(uucp/colorpicker (uucp/colorpicker
:value (:grid/color form) :value (:grid/color form)

View file

@ -53,35 +53,39 @@
;; SLIDEBAR FOR ROTATION AND OPACITY ;; SLIDEBAR FOR ROTATION AND OPACITY
[:span "Size"] [:span "Size"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Width" {:placeholder "Width"
:type "number" :type "number"
:min "0" :min "0"
:value (:rx shape) :value (:rx shape)
:on-change (partial on-size-change :rx)}] :on-change (partial on-size-change :rx)}]]
[:div.lock-size [:div.lock-size
{:class (when (:proportion-lock shape) "selected") {:class (when (:proportion-lock shape) "selected")
:on-click on-proportion-lock-change} :on-click on-proportion-lock-change}
i/lock] i/lock]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Height" {:placeholder "Height"
:type "number" :type "number"
:min "0" :min "0"
:value (:ry shape) :value (:ry shape)
:on-change (partial on-size-change :ry)}]] :on-change (partial on-size-change :ry)}]]]
[:span "Position"] [:span "Position"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "cx" {:placeholder "cx"
:type "number" :type "number"
:value (:cx shape "") :value (:cx shape "")
:on-change (partial on-pos-change :x)}] :on-change (partial on-pos-change :x)}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "cy" {:placeholder "cy"
:type "number" :type "number"
:value (:cy shape "") :value (:cy shape "")
:on-change (partial on-pos-change :y)}]] :on-change (partial on-pos-change :y)}]]]
[:span "Rotation"] [:span "Rotation"]
[:div.row-flex [:div.row-flex
@ -93,6 +97,7 @@
:on-change on-rotation-change}]] :on-change on-rotation-change}]]
[:div.row-flex [:div.row-flex
[:div.input-element.degrees
[:input.input-text [:input.input-text
{:placeholder "" {:placeholder ""
:type "number" :type "number"
@ -100,6 +105,6 @@
:max 360 :max 360
:value (:rotation shape "0") :value (:rotation shape "0")
:on-change on-rotation-change :on-change on-rotation-change
}] }]]
[:input.input-text [:input.input-text
{:style {:visibility "hidden"}}]]]])) {:style {:visibility "hidden"}}]]]]))

View file

@ -57,13 +57,6 @@
[:div.color-info [:div.color-info
[:span (:fill shape "#000000")]]] [:span (:fill shape "#000000")]]]
[:div.row-flex
[:input.input-text
{:placeholder "#"
:type "text"
:value (:fill shape "")
:on-change on-color-change}]]
;; SLIDEBAR FOR ROTATION AND OPACITY ;; SLIDEBAR FOR ROTATION AND OPACITY
[:span "Opacity"] [:span "Opacity"]
[:div.row-flex [:div.row-flex

View file

@ -50,32 +50,36 @@
;; SLIDEBAR FOR ROTATION AND OPACITY ;; SLIDEBAR FOR ROTATION AND OPACITY
[:span "Size"] [:span "Size"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Width" {:placeholder "Width"
:type "number" :type "number"
:min "0" :min "0"
:value (:width size) :value (:width size)
:on-change (partial on-size-change :width)}] :on-change (partial on-size-change :width)}]]
[:div.lock-size i/lock] [:div.lock-size i/lock]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Height" {:placeholder "Height"
:type "number" :type "number"
:min "0" :min "0"
:value (:height size) :value (:height size)
:on-change (partial on-size-change :height)}]] :on-change (partial on-size-change :height)}]]]
[:span "Position"] [:span "Position"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "x" {:placeholder "X"
:type "number" :type "number"
:value (:x1 shape "") :value (:x1 shape "")
:on-change (partial on-pos-change :x)}] :on-change (partial on-pos-change :x)}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "y" {:placeholder "Y"
:type "number" :type "number"
:value (:y1 shape "") :value (:y1 shape "")
:on-change (partial on-pos-change :y)}]] :on-change (partial on-pos-change :y)}]]]
[:span "Rotation"] [:span "Rotation"]
[:div.row-flex [:div.row-flex
@ -87,6 +91,7 @@
:on-change on-rotation-change}]] :on-change on-rotation-change}]]
[:div.row-flex [:div.row-flex
[:div.input-element.degrees
[:input.input-text [:input.input-text
{:placeholder "" {:placeholder ""
:type "number" :type "number"
@ -94,7 +99,7 @@
:max 360 :max 360
:value (:rotation shape "0") :value (:rotation shape "0")
:on-change on-rotation-change :on-change on-rotation-change
}] }]]
[:input.input-text [:input.input-text
{:style {:visibility "hidden"}}] {:style {:visibility "hidden"}}]
]]])))) ]]]))))

View file

@ -228,18 +228,20 @@
(swap! form-ref assoc :moveto-y 0)) (swap! form-ref assoc :moveto-y 0))
(html (html
[:div [:div
[:span "Move to position (px)"] [:span "Move to position"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "X" {:placeholder "X"
:on-change (partial on-change form-ref :moveto-x) :on-change (partial on-change form-ref :moveto-x)
:type "number" :type "number"
:value (:moveto-x @form-ref "")}] :value (:moveto-x @form-ref "")}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Y" {:placeholder "Y"
:on-change (partial on-change form-ref :moveto-y) :on-change (partial on-change form-ref :moveto-y)
:type "number" :type "number"
:value (:moveto-y @form-ref "")}]]])) :value (:moveto-y @form-ref "")}]]]]))
(def moveto-input (def moveto-input
(mx/component (mx/component
@ -256,18 +258,20 @@
(swap! form-ref assoc :moveby-y 0)) (swap! form-ref assoc :moveby-y 0))
(html (html
[:div [:div
[:span "Move to position (px)"] [:span "Move to position"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "X" {:placeholder "X"
:on-change (partial on-change form-ref :moveby-x) :on-change (partial on-change form-ref :moveby-x)
:type "number" :type "number"
:value (:moveby-x @form-ref "")}] :value (:moveby-x @form-ref "")}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Y" {:placeholder "Y"
:on-change (partial on-change form-ref :moveby-y) :on-change (partial on-change form-ref :moveby-y)
:type "number" :type "number"
:value (:moveby-y @form-ref "")}]]])) :value (:moveby-y @form-ref "")}]]]]))
(def moveby-input (def moveby-input
(mx/component (mx/component
@ -282,15 +286,16 @@
(swap! form-ref assoc :opacity 100)) (swap! form-ref assoc :opacity 100))
(html (html
[:div [:div
[:span "Opacity (%)"] [:span "Opacity"]
[:div.row-flex [:div.row-flex
[:div.input-element.percentail
[:input.input-text [:input.input-text
{:placeholder "%" {:placeholder "%"
:on-change (partial on-change form-ref :opacity) :on-change (partial on-change form-ref :opacity)
:min "0" :min "0"
:max "100" :max "100"
:type "number" :type "number"
:value (:opacity @form-ref "")}]]])) :value (:opacity @form-ref "")}]]]]))
(def opacity-input (def opacity-input
(mx/component (mx/component
@ -305,11 +310,12 @@
[:div [:div
[:span "Rotate (dg)"] [:span "Rotate (dg)"]
[:div.row-flex [:div.row-flex
[:div.input-element.degrees
[:input.input-text [:input.input-text
{:placeholder "dg" {:placeholder "dg"
:on-change (partial on-change form-ref :rotation) :on-change (partial on-change form-ref :rotation)
:type "number" :type "number"
:value (:rotation @form-ref "")}]]])) :value (:rotation @form-ref "")}]]]]))
(def rotate-input (def rotate-input
(mx/component (mx/component
@ -322,18 +328,20 @@
[own form-ref] [own form-ref]
(html (html
[:div [:div
[:span "Resize (px)"] [:span "Resize"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Width" {:placeholder "Width"
:on-change (partial on-change form-ref :resize-width) :on-change (partial on-change form-ref :resize-width)
:type "number" :type "number"
:value (:resize-width @form-ref "")}] :value (:resize-width @form-ref "")}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Height" {:placeholder "Height"
:on-change (partial on-change form-ref :resize-height) :on-change (partial on-change form-ref :resize-height)
:type "number" :type "number"
:value (:resize-height @form-ref "")}]]])) :value (:resize-height @form-ref "")}]]]]))
(def resize-input (def resize-input
(mx/component (mx/component
@ -443,17 +451,19 @@
(swap! form-ref assoc :delay 0)) (swap! form-ref assoc :delay 0))
(html (html
[:div [:div
[:span "Duration | Delay (ms)"] [:span "Duration | Delay"]
[:div.row-flex [:div.row-flex
[:div.input-element.miliseconds
[:input.input-text [:input.input-text
{:placeholder "Duration" {:placeholder "Duration"
:type "number" :type "number"
:on-change (partial on-change form-ref :duration) :on-change (partial on-change form-ref :duration)
:value (pr-str (:duration @form-ref))}] :value (pr-str (:duration @form-ref))}]]
[:div.input-element.miliseconds
[:input.input-text {:placeholder "Delay" [:input.input-text {:placeholder "Delay"
:type "number" :type "number"
:on-change (partial on-change form-ref :delay) :on-change (partial on-change form-ref :delay)
:value (pr-str (:delay @form-ref))}]]])) :value (pr-str (:delay @form-ref))}]]]]))
(def duration-input (def duration-input
(mx/component (mx/component

View file

@ -57,35 +57,39 @@
;; SLIDEBAR FOR ROTATION AND OPACITY ;; SLIDEBAR FOR ROTATION AND OPACITY
[:span "Size"] [:span "Size"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Width" {:placeholder "Width"
:type "number" :type "number"
:min "0" :min "0"
:value (:width size) :value (:width size)
:on-change (partial on-size-change :width)}] :on-change (partial on-size-change :width)}]]
[:div.lock-size [:div.lock-size
{:class (when (:proportion-lock shape) "selected") {:class (when (:proportion-lock shape) "selected")
:on-click on-proportion-lock-change} :on-click on-proportion-lock-change}
i/lock] i/lock]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Height" {:placeholder "Height"
:type "number" :type "number"
:min "0" :min "0"
:value (:height size) :value (:height size)
:on-change (partial on-size-change :height)}]] :on-change (partial on-size-change :height)}]]]
[:span "Position"] [:span "Position"]
[:div.row-flex [:div.row-flex
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "x" {:placeholder "x"
:type "number" :type "number"
:value (:x1 shape "") :value (:x1 shape "")
:on-change (partial on-pos-change :x)}] :on-change (partial on-pos-change :x)}]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "y" {:placeholder "y"
:type "number" :type "number"
:value (:y1 shape "") :value (:y1 shape "")
:on-change (partial on-pos-change :y)}]] :on-change (partial on-pos-change :y)}]]]
[:span "Border radius"] [:span "Border radius"]
[:div.row-flex [:div.row-flex
@ -111,6 +115,7 @@
:on-change on-rotation-change}]] :on-change on-rotation-change}]]
[:div.row-flex [:div.row-flex
[:div.input-element.degrees
[:input.input-text [:input.input-text
{:placeholder "" {:placeholder ""
:type "number" :type "number"
@ -118,10 +123,7 @@
:max 360 :max 360
:value (:rotation shape "0") :value (:rotation shape "0")
:on-change on-rotation-change :on-change on-rotation-change
}] }]]
[:input.input-text [:input.input-text
{:style {:visibility "hidden"}}] {:style {:visibility "hidden"}}]
]]]))) ]]])))

View file

@ -64,12 +64,13 @@
[:option {:value ":dotted"} "Dotted"] [:option {:value ":dotted"} "Dotted"]
[:option {:value ":dashed"} "Dashed"] [:option {:value ":dashed"} "Dashed"]
[:option {:value ":mixed"} "Mixed"]] [:option {:value ":mixed"} "Mixed"]]
[:div.input-element.pixels
[:input.input-text [:input.input-text
{:placeholder "Width" {:placeholder "Width"
:type "number" :type "number"
:min "0" :min "0"
:value (:stroke-width shape "1") :value (:stroke-width shape "1")
:on-change on-width-change}]] :on-change on-width-change}]]]
[:span "Color"] [:span "Color"]
[:div.row-flex.color-data [:div.row-flex.color-data

View file

@ -153,21 +153,23 @@
:auto-focus true :auto-focus true
:on-change update-name}] :on-change update-name}]
[:div.project-size [:div.project-size
[:div.input-element.pixels
[:input#project-witdh.input-text [:input#project-witdh.input-text
{:placeholder "Width" {:placeholder "Width"
:type "number" :type "number"
:min 0 :min 0
:max 4000 :max 4000
:value (:width metadata) :value (:width metadata)
:on-change #(update-size :width %)}] :on-change #(update-size :width %)}]]
[:a.toggle-layout {:on-click toggle-sizes} i/toggle] [:a.toggle-layout {:on-click toggle-sizes} i/toggle]
[:div.input-element.pixels
[:input#project-height.input-text [:input#project-height.input-text
{:placeholder "Height" {:placeholder "Height"
:type "number" :type "number"
:min 0 :min 0
:max 4000 :max 4000
:value (:height metadata) :value (:height metadata)
:on-change #(update-size :height %)}]] :on-change #(update-size :height %)}]]]
[:div.input-radio.radio-primary [:div.input-radio.radio-primary
(layout-input local page "mobile") (layout-input local page "mobile")