Highlight advanced settings label when selected

This commit is contained in:
Vitaliy Vlasov 2018-08-01 00:03:40 -06:00
parent f5e343c08a
commit 1dd9591b5e
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964
2 changed files with 28 additions and 21 deletions

View File

@ -9,16 +9,20 @@
:align-items :center :align-items :center
:margin-bottom 16}) :margin-bottom 16})
(def profile-row (defn profile-row [active?]
{:justify-content :space-between {:justify-content :space-between
:flex-direction :row :flex-direction :row
:margin-horizontal 24 :padding-horizontal 24
:align-self :stretch :height 56
:margin-top 40}) :align-self :stretch
:align-items :center
:background-color (if active? colors/gray-lighter colors/white)
:margin-top 20})
(defn profile-row-text [color] (defn profile-row-text [color active?]
{:color color {:color color
:font-size 16}) :font-weight (if active? "600" :normal)
:font-size 16})
(def profile-photo (def profile-photo
{:border-radius 100 {:border-radius 100
@ -138,7 +142,7 @@
(def advanced-settings-title (def advanced-settings-title
{:margin 24 {:margin 24
:font-size 20 :font-size 20
:font-weight "600"}) :font-weight "600"})
(def title-separator (def title-separator
{:height 1 {:height 1

View File

@ -81,17 +81,20 @@
[vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]]) [vector-icons/icon :icons/qr {:style {:tint-color colors/blue}}]]]])
(views/defview profile [user] (views/defview profile [user]
[react/view styles/profile-view (views/letsubs [current-view-id [:get :view-id]]
[profile-badge user] (let [adv-settings-open? (= current-view-id :advanced-settings)]
[share-contact-code] [react/view styles/profile-view
[react/view {:style styles/profile-row} [profile-badge user]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :advanced-settings])} [share-contact-code]
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/advanced-settings)]] [react/view {:style (styles/profile-row adv-settings-open?)}
[vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]] [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to (if adv-settings-open? :home :advanced-settings)])}
[react/view {:style styles/profile-row} [react/text {:style (styles/profile-row-text colors/black adv-settings-open?)} (i18n/label :t/advanced-settings)]]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])} [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to (if adv-settings-open? :intro :home)])}
[react/text {:style (styles/profile-row-text colors/red)} (i18n/label :t/logout)]] [vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]]]
[react/view [react/text {:style (styles/profile-row-text colors/gray)} "V" build/version " (" build/commit-sha ")"]]]]) [react/view {:style (styles/profile-row false)}
[react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])}
[react/text {:style (styles/profile-row-text colors/red false)} (i18n/label :t/logout)]]
[react/view [react/text {:style (styles/profile-row-text colors/gray false)} "V" build/version " (" build/commit-sha ")"]]]])))
(views/defview profile-data [] (views/defview profile-data []
(views/letsubs (views/letsubs