From b5ea433420517a88bb8aba43d1eab928baf0070d Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Tue, 21 Jun 2016 17:39:05 +0300 Subject: [PATCH] added disabled state for create contact button --- src/status_im/contacts/views/new_contact.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/status_im/contacts/views/new_contact.cljs b/src/status_im/contacts/views/new_contact.cljs index 9c09c3a806..94b25f115f 100644 --- a/src/status_im/contacts/views/new_contact.cljs +++ b/src/status_im/contacts/views/new_contact.cljs @@ -1,6 +1,7 @@ (ns status-im.contacts.views.new-contact (:require-macros [status-im.utils.views :refer [defview]]) (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [clojure.string :as str] [status-im.components.react :refer [view text text-input @@ -31,6 +32,9 @@ [text {:style toolbar-title-text} (label :t/add-new-contact)]]) +(defn valid-form? [name address] + (and (not (str/blank? name)) (not (str/blank? address)))) + (defview contact-name-input [name] [] [text-input @@ -63,7 +67,9 @@ :style icon-back} :handler #(dispatch [:navigate-back])} :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} :handler #(dispatch [:add-new-contact new-contact])}}] [view st/form-container