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

View File

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