Merge pull request #357 from status-im/bug/#350

Status styles in profile and drawer (#350)

Former-commit-id: eb50cdd83e
This commit is contained in:
Roman Volosovskyi 2016-10-14 20:17:08 +03:00 committed by GitHub
commit 3ea54eac5a
4 changed files with 53 additions and 61 deletions

View File

@ -111,9 +111,9 @@
(def online-dot-right (merge online-dot {:left 10})) (def online-dot-right (merge online-dot {:left 10}))
(def photo-pencil (def photo-pencil
{:margin-left 5 {:margin-left 8
:margin-right 5 :margin-right 2
:margin-top 3 :margin-top 6
:font-size 12 :font-size 12
:color :white}) :color :white})

View File

@ -10,7 +10,8 @@
text1-color text1-color
text2-color text2-color
text3-color text3-color
color-red]])) color-red]]
[status-im.utils.platform :as p]))
(def drawer-menu (def drawer-menu
{:flex 1 {:flex 1
@ -28,10 +29,10 @@
:height 64}) :height 64})
(def name-container (def name-container
{:margin-top -16 {:margin-top (if p/ios? -13 -19)
:margin-bottom -16 :margin-bottom -16
:margin-left 16 :margin-left 16
:margin-right 16}) :margin-right 16})
(def name-input-wrapper (def name-input-wrapper
{}) {})
@ -44,7 +45,7 @@
(def status-container (def status-container
{:margin-left 16 {:margin-left 16
:margin-right 16 :margin-right 16
:margin-top 4 :margin-top (if p/ios? 5 5)
:align-items :center}) :align-items :center})
(def status-input (def status-input
@ -52,7 +53,6 @@
:height 56 :height 56
:font-size 14 :font-size 14
:padding-left 4 :padding-left 4
:line-height 20
:text-align :center :text-align :center
:text-align-vertical :top :text-align-vertical :top
:color text2-color}) :color text2-color})

View File

@ -68,7 +68,7 @@
(map get-text))) (map get-text)))
(defn status-image-view [{{:keys [name status photo-path]} :account (defn status-image-view [{{:keys [name status photo-path]} :account
edit? :edit?}] edit? :edit?}]
[view st/status-block [view st/status-block
[view st/user-photo-container [view st/user-photo-container
(if edit? (if edit?
@ -90,14 +90,13 @@
:wrapper-style st/username-wrapper :wrapper-style st/username-wrapper
:value name :value name
:on-change-text #(dispatch [:set-in [:profile-edit :name] %])}] :on-change-text #(dispatch [:set-in [:profile-edit :name] %])}]
(if edit? [text-input {:style st/status-input
[text-input {:style st/status-input :maxLength 140
:maxLength 140 :multiline true
:editable edit? :editable edit?
:placeholder (label :t/profile-no-status) :placeholder (label :t/profile-no-status)
:on-change-text #(dispatch [:set-in [:profile-edit :status] %]) :on-change-text #(dispatch [:set-in [:profile-edit :status] %])
:default-value status}] :default-value status}]])
[text {:style st/status-text} (highlight-tags status)])])
(defview profile [] (defview profile []
[{whisper-identity :whisper-identity [{whisper-identity :whisper-identity
@ -163,42 +162,42 @@
[view [text {:style st/report-user-text} (label :t/report-user)]]]]]]) [view [text {:style st/report-user-text} (label :t/report-user)]]]]]])
(defview my-profile [] (defview my-profile []
[edit? [:get-in [:profile-edit :edit?]] [edit? [:get-in [:profile-edit :edit?]]
current-account [:get-current-account] current-account [:get-current-account]
changed-account [:get :profile-edit]] changed-account [:get :profile-edit]]
(let [{:keys [phone (let [{:keys [phone
address address
public-key] :as account} (if edit? public-key] :as account} (if edit?
changed-account changed-account
current-account)] current-account)]
[scroll-view {:style st/profile [scroll-view {:style st/profile
:keyboardShouldPersistTaps true} :keyboardShouldPersistTaps true}
[status-bar] [status-bar]
[toolbar {:account account [toolbar {:account account
:edit? edit?}] :edit? edit?}]
[status-image-view {:account account [status-image-view {:account account
:edit? edit?}] :edit? edit?}]
[scroll-view (merge st/profile-properties-container {:keyboardShouldPersistTaps true}) [scroll-view (merge st/profile-properties-container {:keyboardShouldPersistTaps true})
[view st/profile-property [view st/profile-property
[selectable-field {:label (label :t/phone-number) [selectable-field {:label (label :t/phone-number)
:value (if (and phone (not (str/blank? phone))) :value (if (and phone (not (str/blank? phone)))
(format-phone-number phone) (format-phone-number phone)
(label :t/not-specified))}] (label :t/not-specified))}]
[view st/underline-container]] [view st/underline-container]]
[view st/profile-property [view st/profile-property
[selectable-field {:label (label :t/address) [selectable-field {:label (label :t/address)
:value address}] :value address}]
[view st/underline-container]] [view st/underline-container]]
[view st/profile-property [view st/profile-property
[selectable-field {:label (label :t/public-key) [selectable-field {:label (label :t/public-key)
:value public-key}]] :value public-key}]]
[view st/underline-container] [view st/underline-container]
[view st/qr-code-container [view st/qr-code-container
[qr-code {:value (str "ethereum:" public-key) [qr-code {:value (str "ethereum:" public-key)
:size 220}]]]])) :size 220}]]]]))

View File

@ -11,7 +11,8 @@
text1-color text1-color
text1-disabled-color text1-disabled-color
text2-color text2-color
color-red]])) color-red]]
[status-im.utils.platform :as p]))
(def profile (def profile
{:flex 1 {:flex 1
@ -54,7 +55,7 @@
(def username-wrapper (def username-wrapper
{:width 300 {:width 300
:margin-top -22 :margin-top (if p/ios? -18 -22)
:margin-bottom -16}) :margin-bottom -16})
(defn username-input [edit? valid?] (defn username-input [edit? valid?]
@ -76,20 +77,12 @@
{:align-self "stretch" {:align-self "stretch"
:margin-left 16 :margin-left 16
:margin-right 16 :margin-right 16
:height 40 :margin-top (if p/ios? 6 1)
:margin-top 0
:font-size 14 :font-size 14
:line-height 20 :min-height 60
:text-align :center :text-align :center
:color text2-color}) :color text2-color})
(def status-text
{:text-align :center
:margin-left 0
:margin-right 0
:margin-top 10
:color text2-color})
(def btns-container (def btns-container
{:margin-top 18 {:margin-top 18
:flex-direction :row}) :flex-direction :row})