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,15 +9,19 @@
: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
:height 56
:align-self :stretch :align-self :stretch
:margin-top 40}) :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-weight (if active? "600" :normal)
:font-size 16}) :font-size 16})
(def profile-photo (def profile-photo

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]
(views/letsubs [current-view-id [:get :view-id]]
(let [adv-settings-open? (= current-view-id :advanced-settings)]
[react/view styles/profile-view [react/view styles/profile-view
[profile-badge user] [profile-badge user]
[share-contact-code] [share-contact-code]
[react/view {:style styles/profile-row} [react/view {:style (styles/profile-row adv-settings-open?)}
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :advanced-settings])} [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to (if adv-settings-open? :home :advanced-settings)])}
[react/text {:style (styles/profile-row-text colors/black)} (i18n/label :t/advanced-settings)]] [react/text {:style (styles/profile-row-text colors/black adv-settings-open?)} (i18n/label :t/advanced-settings)]]
[vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]] [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to (if adv-settings-open? :intro :home)])}
[react/view {:style styles/profile-row} [vector-icons/icon :icons/forward {:style {:tint-color colors/gray}}]]]
[react/view {:style (styles/profile-row false)}
[react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])} [react/touchable-highlight {:on-press #(re-frame/dispatch [:logout])}
[react/text {:style (styles/profile-row-text colors/red)} (i18n/label :t/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)} "V" build/version " (" build/commit-sha ")"]]]]) [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