commands button
This commit is contained in:
parent
952d3736c8
commit
e728c155a1
Binary file not shown.
After Width: | Height: | Size: 469 B |
Binary file not shown.
After Width: | Height: | Size: 247 B |
Binary file not shown.
After Width: | Height: | Size: 333 B |
Binary file not shown.
After Width: | Height: | Size: 651 B |
Binary file not shown.
After Width: | Height: | Size: 823 B |
|
@ -9,11 +9,24 @@
|
||||||
:justifyContent :center})
|
:justifyContent :center})
|
||||||
|
|
||||||
(defn message-input-button [scale]
|
(defn message-input-button [scale]
|
||||||
{:transform [{:scale scale}]})
|
{:transform [{:scale scale}]
|
||||||
|
:width 24
|
||||||
|
:height 24
|
||||||
|
:alignItems :center
|
||||||
|
:justifyContent :center})
|
||||||
|
|
||||||
(def list-icon
|
(def list-icon
|
||||||
{:width 13
|
{:width 16
|
||||||
:height 12})
|
:height 16})
|
||||||
|
|
||||||
|
(def requests-icon
|
||||||
|
{:background-color :#7099e6
|
||||||
|
:width 8
|
||||||
|
:height 8
|
||||||
|
:border-radius 8
|
||||||
|
:left 0
|
||||||
|
:top 0
|
||||||
|
:position :absolute})
|
||||||
|
|
||||||
(def close-icon
|
(def close-icon
|
||||||
{:width 12
|
{:width 12
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view
|
||||||
animated-view
|
animated-view
|
||||||
icon
|
icon
|
||||||
|
text
|
||||||
touchable-highlight]]
|
touchable-highlight]]
|
||||||
[status-im.components.animation :as anim]
|
[status-im.components.animation :as anim]
|
||||||
[status-im.chat.styles.plain-message :as st]
|
[status-im.chat.styles.plain-message :as st]
|
||||||
|
@ -30,22 +31,24 @@
|
||||||
(defn list-container [min]
|
(defn list-container [min]
|
||||||
(fn [{:keys [command? width]}]
|
(fn [{:keys [command? width]}]
|
||||||
(let [n-width (if @command? min 56)
|
(let [n-width (if @command? min 56)
|
||||||
delay (if @command? 100 0)]
|
delay (if @command? 100 0)]
|
||||||
(anim/start (anim/timing width {:toValue n-width
|
(anim/start (anim/timing width {:toValue n-width
|
||||||
:duration response-input-hiding-duration
|
:duration response-input-hiding-duration
|
||||||
:delay delay})
|
:delay delay})
|
||||||
#(dispatch [:set :disable-input false])))))
|
#(dispatch [:set :disable-input false])))))
|
||||||
|
|
||||||
(defn commands-button []
|
(defn commands-button []
|
||||||
(let [command? (subscribe [:command?])
|
(let [command? (subscribe [:command?])
|
||||||
buttons-scale (anim/create-value (if @command? 1 0))
|
requests (subscribe [:get-requests])
|
||||||
|
suggestions (subscribe [:get-suggestions])
|
||||||
|
buttons-scale (anim/create-value (if @command? 1 0))
|
||||||
container-width (anim/create-value (if @command? 20 56))
|
container-width (anim/create-value (if @command? 20 56))
|
||||||
context {:command? command?
|
context {:command? command?
|
||||||
:val buttons-scale
|
:val buttons-scale
|
||||||
:width container-width}
|
:width container-width}
|
||||||
on-update (fn [_]
|
on-update (fn [_]
|
||||||
((button-animation-logic context))
|
((button-animation-logic context))
|
||||||
((list-container 20) context))]
|
((list-container 20) context))]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
on-update
|
on-update
|
||||||
|
@ -58,7 +61,12 @@
|
||||||
[animated-view {:style (st/message-input-button-touchable
|
[animated-view {:style (st/message-input-button-touchable
|
||||||
container-width)}
|
container-width)}
|
||||||
[animated-view {:style (st/message-input-button buttons-scale)}
|
[animated-view {:style (st/message-input-button buttons-scale)}
|
||||||
[icon :list st/list-icon]]]])})))
|
(if (seq @suggestions)
|
||||||
|
[icon :close_gray st/close-icon]
|
||||||
|
[icon :input_list st/list-icon])
|
||||||
|
(when (and (seq @requests)
|
||||||
|
(not (seq @suggestions)))
|
||||||
|
[view st/requests-icon])]]])})))
|
||||||
|
|
||||||
(defn smile-animation-logic [{:keys [command? val width]}]
|
(defn smile-animation-logic [{:keys [command? val width]}]
|
||||||
(fn [_]
|
(fn [_]
|
||||||
|
@ -71,13 +79,13 @@
|
||||||
(anim/set-value width 0.1)))))))
|
(anim/set-value width 0.1)))))))
|
||||||
|
|
||||||
(defn smile-button []
|
(defn smile-button []
|
||||||
(let [command? (subscribe [:command?])
|
(let [command? (subscribe [:command?])
|
||||||
buttons-scale (anim/create-value (if @command? 1 0))
|
buttons-scale (anim/create-value (if @command? 1 0))
|
||||||
container-width (anim/create-value (if @command? 0.1 56))
|
container-width (anim/create-value (if @command? 0.1 56))
|
||||||
context {:command? command?
|
context {:command? command?
|
||||||
:val buttons-scale
|
:val buttons-scale
|
||||||
:width container-width}
|
:width container-width}
|
||||||
on-update (smile-animation-logic context)]
|
on-update (smile-animation-logic context)]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
on-update
|
on-update
|
||||||
|
|
Loading…
Reference in New Issue