[ISSUE #3492] Fixed action text style

Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
Julien Eluard 2018-03-13 16:00:33 +01:00
parent ed7176d65c
commit 05fffe1652
No known key found for this signature in database
GPG Key ID: 6FD7DB5437FCBEF6
6 changed files with 25 additions and 51 deletions

View File

@ -1,8 +1,8 @@
(ns status-im.ui.components.toolbar.styles (ns status-im.ui.components.toolbar.styles
(:require-macros [status-im.utils.styles :refer [defstyle defnstyle]]) (:require-macros [status-im.utils.styles :refer [defstyle defnstyle]])
(:require [status-im.ui.components.styles :as styles])) (:require [status-im.ui.components.colors :as colors]))
(def toolbar-background1 styles/color-white) (def toolbar-background colors/white)
(def toolbar-height 56) (def toolbar-height 56)
(def toolbar-icon-width 24) (def toolbar-icon-width 24)
@ -14,7 +14,7 @@
:flex-direction :row :flex-direction :row
:align-items :center :align-items :center
:justify-content :space-between :justify-content :space-between
:background-color (or background-color toolbar-background1) :background-color (or background-color toolbar-background)
:elevation (if flat? 0 2) :elevation (if flat? 0 2)
:android {:height 55} :android {:height 55}
:ios {:height 56}}) :ios {:height 56}})
@ -33,7 +33,7 @@
:margin-left 6}) :margin-left 6})
(defstyle toolbar-title-text (defstyle toolbar-title-text
{:color styles/text1-color {:color colors/black
:letter-spacing -0.2 :letter-spacing -0.2
:font-size 17 :font-size 17
:text-align :center}) :text-align :center})
@ -49,8 +49,7 @@
{:width (+ toolbar-icon-width toolbar-icon-spacing)}))) {:width (+ toolbar-icon-width toolbar-icon-spacing)})))
(def toolbar-action (def toolbar-action
{:width toolbar-icon-width {:flex 1
:height toolbar-icon-height
:align-items :center :align-items :center
:justify-content :center}) :justify-content :center})
@ -63,17 +62,24 @@
:padding-horizontal 12}) :padding-horizontal 12})
(defstyle item (defstyle item
{:ios {:margin-horizontal 12 {:ios {:padding-horizontal 12
:margin-vertical 16} :padding-vertical 16}
:android {:margin 16}}) :android {:padding 16}})
(def item-text (def item-text
{:color styles/color-blue4 {:color colors/blue
:font-size 17}) :font-size 17})
(def toolbar-text-action-disabled {:color styles/color-gray7}) (defstyle item-text-action
{:color colors/blue
:ios {:font-size 15
:letter-spacing -0.2}
:android {:font-size 14
:letter-spacing 0.5}})
(def item-text-white-background {:color styles/color-blue4}) (def toolbar-text-action-disabled {:color colors/gray})
(def item-text-white-background {:color colors/blue})
;;TODO(goranjovic) - Breaks the toolbar title into new line on smaller screens ;;TODO(goranjovic) - Breaks the toolbar title into new line on smaller screens
;;e.g. see Discover > Popular hashtags on iPhone 5s ;;e.g. see Discover > Popular hashtags on iPhone 5s

View File

@ -72,11 +72,11 @@
;; Actions ;; Actions
(defn text-action [{:keys [style handler disabled? uppercase?]} title] (defn text-action [{:keys [style handler disabled?]} title]
[react/text {:style (merge styles/item styles/item-text style [react/text {:style (merge styles/item styles/item-text-action style
(when disabled? styles/toolbar-text-action-disabled)) (when disabled? styles/toolbar-text-action-disabled))
:on-press (when-not disabled? handler) :on-press (when-not disabled? handler)
:uppercase? uppercase?} :uppercase? components.styles/uppercase?}
title]) title])
(def blank-action [react/view {:style (merge styles/item styles/toolbar-action)}]) (def blank-action [react/view {:style (merge styles/item styles/toolbar-action)}])
@ -86,7 +86,7 @@
[react/view {:style (merge styles/item styles/toolbar-action)} [react/view {:style (merge styles/item styles/toolbar-action)}
(when overlay-style (when overlay-style
[react/view overlay-style]) [react/view overlay-style])
[vector-icons/icon icon icon-opts]]]) [vector-icons/icon icon (merge {:container-style styles/action-default} icon-opts)]]])
(defn- option-actions [icon icon-opts options] (defn- option-actions [icon icon-opts options]
[icon-action icon icon-opts [icon-action icon icon-opts

View File

@ -8,8 +8,7 @@
[status-im.ui.components.status-bar.view :refer [status-bar]] [status-im.ui.components.status-bar.view :refer [status-bar]]
[status-im.ui.components.toolbar.view :as toolbar] [status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.screens.group.styles :as styles] [status-im.ui.screens.group.styles :as styles]
[status-im.ui.screens.contacts.styles :as contacts.styles] [status-im.ui.screens.contacts.styles :as contacts.styles]))
[status-im.ui.components.styles :as components.styles]))
(defn- on-toggle [checked? whisper-identity] (defn- on-toggle [checked? whisper-identity]
(let [action (if checked? :deselect-contact :select-contact)] (let [action (if checked? :deselect-contact :select-contact)]
@ -30,9 +29,7 @@
toolbar/default-nav-back toolbar/default-nav-back
[toolbar/content-title title] [toolbar/content-title title]
(when (pos? count) (when (pos? count)
[toolbar/text-action {:handler handler [toolbar/text-action {:handler handler}
:uppercase? components.styles/uppercase?
:style styles/toggle-list-action}
label])]) label])])
(defn toggle-list [contacts render-function] (defn toggle-list [contacts render-function]
@ -70,20 +67,6 @@
(:name group)] (:name group)]
[toggle-list contacts group-toggle-contact]])) [toggle-list contacts group-toggle-contact]]))
(defn toggle-participants-handler []
(re-frame/dispatch [:add-new-group-chat-participants])
(re-frame/dispatch [:navigate-back]))
(defn add-participants-toggle-list-toolbar [selected-contacts-count]
[toolbar/toolbar {}
toolbar/default-nav-back
[toolbar/content-title (i18n/label :t/add-members)]
(when (pos? selected-contacts-count)
[toolbar/text-action {:handler toggle-participants-handler
:uppercase? components.styles/uppercase?
:style styles/toggle-list-action}
(i18n/label :t/add)])])
(defview add-participants-toggle-list [] (defview add-participants-toggle-list []
(letsubs [contacts [:all-new-contacts] (letsubs [contacts [:all-new-contacts]
chat-name [:chat :name] chat-name [:chat :name]

View File

@ -170,9 +170,3 @@
(def list-view-container (def list-view-container
{:flex 1 {:flex 1
:margin-top 10}) :margin-top 10})
(defstyle toggle-list-action
{:font-size 14
:android {:font-weight "500"}})

View File

@ -13,15 +13,6 @@
[status-im.ui.screens.group.styles :as styles] [status-im.ui.screens.group.styles :as styles]
[status-im.ui.screens.group.db :as v])) [status-im.ui.screens.group.db :as v]))
(defn group-toolbar [group-type edit?]
[react/view
[status-bar/status-bar]
[toolbar/simple-toolbar
(i18n/label
(if (= group-type :contact-group)
(if edit? :t/edit-group :t/new-group)
(if edit? :t/chat-settings :t/group-chat)))]])
(views/defview group-name-view [] (views/defview group-name-view []
(views/letsubs [new-group-name [:get :new-chat-name]] (views/letsubs [new-group-name [:get :new-chat-name]]
[react/view add-new.styles/input-container [react/view add-new.styles/input-container

View File

@ -37,7 +37,7 @@
(views/defview home-list-deletable [[home-item-id home-item]] (views/defview home-list-deletable [[home-item-id home-item]]
(views/letsubs [swiped? [:delete-swipe-position home-item-id]] (views/letsubs [swiped? [:delete-swipe-position home-item-id]]
(let [delete-action (if (:chat-id home-item) :remove-chat :remove-browser) (let [delete-action (if (:chat-id home-item) :remove-chat :remove-browser)
inner-item-view (if (:chat-id home-item) inner-item-view (if (:chat-id home-item)
inner-item/home-list-chat-item-inner-view inner-item/home-list-chat-item-inner-view
inner-item/home-list-browser-item-inner-view) inner-item/home-list-browser-item-inner-view)
offset-x (animation/create-value (if swiped? styles/delete-button-width 0)) offset-x (animation/create-value (if swiped? styles/delete-button-width 0))