added disabled state for create contact button
Former-commit-id: b5ea433420
This commit is contained in:
parent
a9d2ed2711
commit
bfcc63fc05
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.contacts.views.new-contact
|
(ns status-im.contacts.views.new-contact
|
||||||
(:require-macros [status-im.utils.views :refer [defview]])
|
(:require-macros [status-im.utils.views :refer [defview]])
|
||||||
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
|
[clojure.string :as str]
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view
|
||||||
text
|
text
|
||||||
text-input
|
text-input
|
||||||
|
@ -31,6 +32,9 @@
|
||||||
[text {:style toolbar-title-text}
|
[text {:style toolbar-title-text}
|
||||||
(label :t/add-new-contact)]])
|
(label :t/add-new-contact)]])
|
||||||
|
|
||||||
|
(defn valid-form? [name address]
|
||||||
|
(and (not (str/blank? name)) (not (str/blank? address))))
|
||||||
|
|
||||||
(defview contact-name-input [name]
|
(defview contact-name-input [name]
|
||||||
[]
|
[]
|
||||||
[text-input
|
[text-input
|
||||||
|
@ -63,7 +67,9 @@
|
||||||
:style icon-back}
|
:style icon-back}
|
||||||
:handler #(dispatch [:navigate-back])}
|
:handler #(dispatch [:navigate-back])}
|
||||||
:custom-content toolbar-title
|
:custom-content toolbar-title
|
||||||
:action {:image {:source {:uri :icon_ok_blue}
|
:action {:image {:source {:uri (if (valid-form? name whisper-identity)
|
||||||
|
:icon_ok_blue
|
||||||
|
:icon_ok_disabled)}
|
||||||
:style icon-search}
|
:style icon-search}
|
||||||
:handler #(dispatch [:add-new-contact new-contact])}}]
|
:handler #(dispatch [:add-new-contact new-contact])}}]
|
||||||
[view st/form-container
|
[view st/form-container
|
||||||
|
|
Loading…
Reference in New Issue