[FIX #1772] Fixed incorrect icon padding

This commit is contained in:
Julien Eluard 2017-09-07 17:11:28 +02:00 committed by Roman Volosovskyi
parent 5d2a0e836a
commit 97789feb6b
7 changed files with 65 additions and 74 deletions

View File

@ -95,9 +95,4 @@
color color
:else :else
st/icon-dark-color)))) st/icon-dark-color))))
(throw (js/Error. (str "Unknown icon: " name))))])) (throw (js/Error. (str "Unknown icon: " name))))]))
(defn touchable-icon [n opts handler]
[rn/touchable-highlight {:on-press handler}
[rn/view
[icon n opts]]])

View File

@ -95,14 +95,8 @@
:android {:margin 16}}) :android {:margin 16}})
(def item-text (def item-text
(merge item {:color st/color-blue4
{:color st/color-blue4 :font-size 17})
:font-size 17}))
(def toolbar-text-action
(merge item
{:color st/color-blue4
:font-size 17}))
(def item-text-white-background {:color st/color-blue4}) (def item-text-white-background {:color st/color-blue4})

View File

@ -29,7 +29,7 @@
([text] (nav-text text nil)) ([text] (nav-text text nil))
([text handler] (nav-text nil text handler)) ([text handler] (nav-text nil text handler))
([props text handler] ([props text handler]
[rn/text (merge {:style tst/item-text :on-press (or handler #(rf/dispatch [:navigate-back]))}) [rn/text (merge {:style (merge tst/item tst/item-text) :on-press (or handler #(rf/dispatch [:navigate-back]))})
text])) text]))
(defn nav-clear-text (defn nav-clear-text
@ -52,14 +52,14 @@
;; Actions ;; Actions
(defn text-action [handler title] (defn text-action [handler title]
[rn/text {:style tst/toolbar-text-action :on-press handler} [rn/text {:style (merge tst/item tst/item-text) :on-press handler}
title]) title])
(def blank-action [rn/view tst/toolbar-action]) (def blank-action [rn/view {:style (merge tst/item tst/toolbar-action)}])
(defn- option-actions [icon icon-opts options] (defn- option-actions [icon icon-opts options]
[context-menu/context-menu [context-menu/context-menu
[rn/view tst/toolbar-action [rn/view {:style (merge tst/item tst/toolbar-action)}
[vi/icon icon icon-opts]] [vi/icon icon icon-opts]]
options options
nil nil
@ -83,7 +83,7 @@
:else :else
[icon-action icon icon-opts handler]) [icon-action icon icon-opts handler])
{:key (str "action-" image)}))]) {:key (str "action-" (or image icon))}))])
(defn toolbar2 (defn toolbar2
([title] (toolbar2 nil title)) ([title] (toolbar2 nil title))

View File

@ -342,6 +342,7 @@
:wallet-assets "Assets" :wallet-assets "Assets"
:wallet-add-asset "Add asset" :wallet-add-asset "Add asset"
:wallet-total-value "Total value" :wallet-total-value "Total value"
:wallet-settings "Wallet Settings"
:transactions "Transactions" :transactions "Transactions"
:transactions-sign "Sign" :transactions-sign "Sign"
:transactions-sign-all "Sign all" :transactions-sign-all "Sign all"

View File

@ -1,20 +1,14 @@
(ns status-im.ui.screens.chats-list.views (ns status-im.ui.screens.chats-list.views
(:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [re-frame.core :refer [dispatch]] (:require [re-frame.core :as re-frame]
[status-im.components.common.common :as common] [status-im.components.common.common :as common]
[status-im.components.renderers.renderers :as renderers] [status-im.components.renderers.renderers :as renderers]
[status-im.components.react :refer [list-view [status-im.components.react :as react]
list-item
view
animated-view
text
image
touchable-highlight]]
[status-im.components.native-action-button :refer [native-action-button]] [status-im.components.native-action-button :refer [native-action-button]]
[status-im.components.drawer.view :refer [open-drawer]] [status-im.components.drawer.view :refer [open-drawer]]
[status-im.components.styles :refer [color-blue]] [status-im.components.styles :refer [color-blue]]
[status-im.components.status-bar :refer [status-bar]] [status-im.components.status-bar :refer [status-bar]]
[status-im.components.toolbar-new.view :refer [toolbar toolbar-with-search]] [status-im.components.toolbar-new.view :as toolbar]
[status-im.components.toolbar-new.actions :as act] [status-im.components.toolbar-new.actions :as act]
[status-im.components.toolbar-new.styles :as tst] [status-im.components.toolbar-new.styles :as tst]
[status-im.components.icons.custom-icons :refer [ion-icon]] [status-im.components.icons.custom-icons :refer [ion-icon]]
@ -22,47 +16,50 @@
[status-im.components.context-menu :refer [context-menu]] [status-im.components.context-menu :refer [context-menu]]
[status-im.components.tabs.styles :refer [tabs-height]] [status-im.components.tabs.styles :refer [tabs-height]]
[status-im.utils.listview :refer [to-datasource]] [status-im.utils.listview :refer [to-datasource]]
[status-im.ui.screens.chats-list.views.inner-item :refer [chat-list-item-inner-view]] [status-im.ui.screens.chats-list.views.inner-item :as inner-item]
[status-im.ui.screens.chats-list.styles :as st] [status-im.ui.screens.chats-list.styles :as st]
[status-im.i18n :refer [label]] [status-im.i18n :as i18n]
[status-im.utils.platform :refer [platform-specific ios?]] [status-im.utils.platform :refer [platform-specific ios?]]
[status-im.utils.notifications :as notifications])) [status-im.utils.notifications :as notifications]))
(def android-toolbar-popup-options (def android-toolbar-popup-options
[{:text (label :t/edit) :value #(dispatch [:set-in [:chat-list-ui-props :edit?] true])}]) [{:text (i18n/label :t/edit) :value #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] true])}])
(defn android-toolbar-actions [] (defn android-toolbar-actions []
[(act/search #(dispatch [:set-in [:toolbar-search :show] true])) [(act/search #(re-frame/dispatch [:set-in [:toolbar-search :show] true]))
(act/opts android-toolbar-popup-options)]) (act/opts android-toolbar-popup-options)])
(def ios-toolbar-popup-options (def ios-toolbar-popup-options
[{:text (label :t/edit-chats) :value #(dispatch [:set-in [:chat-list-ui-props :edit?] true])} [{:text (i18n/label :t/edit-chats) :value #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] true])}
{:text (label :t/search-chats) :value #(dispatch [:set-in [:toolbar-search :show] true])}]) {:text (i18n/label :t/search-chats) :value #(re-frame/dispatch [:set-in [:toolbar-search :show] true])}])
(defn ios-toolbar-actions [] (defn ios-toolbar-actions []
[(act/opts ios-toolbar-popup-options) [(act/opts ios-toolbar-popup-options)
(act/add #(dispatch [:navigate-to :new-chat]))]) (act/add #(re-frame/dispatch [:navigate-to :new-chat]))])
(defn toolbar-view [] (defn toolbar-view []
[toolbar {:title (label :t/chats) [toolbar/toolbar2 {}
:nav-action (act/hamburger open-drawer) [toolbar/nav-button (act/hamburger open-drawer)]
:actions (if ios? [toolbar/content-title (i18n/label :t/chats)]
(ios-toolbar-actions) [toolbar/actions
(android-toolbar-actions))}]) (if ios?
(ios-toolbar-actions)
(android-toolbar-actions))]])
(defn toolbar-edit [] (defn toolbar-edit []
[toolbar {:nav-action (act/back #(dispatch [:set-in [:chat-list-ui-props :edit?] false])) [toolbar/toolbar2 {}
:title (label :t/edit-chats) [toolbar/nav-button (act/back #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] false]))]
:actions [{:image :blank}]}]) [toolbar/content-title (i18n/label :t/edit-chats)]
[toolbar/actions [{:image :blank}]]])
(defview toolbar-search [] (defview toolbar-search []
(letsubs [search-text [:get-in [:toolbar-search :text]]] (letsubs [search-text [:get-in [:toolbar-search :text]]]
[toolbar-with-search [toolbar/toolbar-with-search
{:show-search? true {:show-search? true
:search-text search-text :search-text search-text
:search-key :chat-list :search-key :chat-list
:title (label :t/chats) :title (i18n/label :t/chats)
:search-placeholder (label :t/search-for)}])) :search-placeholder (i18n/label :t/search-for)}]))
(defn chats-action-button [] (defn chats-action-button []
[native-action-button {:button-color color-blue [native-action-button {:button-color color-blue
@ -70,33 +67,33 @@
:offset-y 40 :offset-y 40
:spacing 13 :spacing 13
:hide-shadow true :hide-shadow true
:on-press #(dispatch [:navigate-to :new-chat])}]) :on-press #(re-frame/dispatch [:navigate-to :new-chat])}])
(defn chat-list-item [[chat-id chat] edit?] (defn chat-list-item [[chat-id chat] edit?]
[touchable-highlight {:on-press #(dispatch [:navigate-to :chat chat-id])} [react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :chat chat-id])}
[view [react/view
[chat-list-item-inner-view (assoc chat :chat-id chat-id) edit?]]]) [inner-item/chat-list-item-inner-view (assoc chat :chat-id chat-id) edit?]]])
(defview chats-list [] (defview chats-list []
(letsubs [chats [:filtered-chats] (letsubs [chats [:filtered-chats]
edit? [:get-in [:chat-list-ui-props :edit?]] edit? [:get-in [:chat-list-ui-props :edit?]]
search? [:get-in [:toolbar-search :show]] search? [:get-in [:toolbar-search :show]]
tabs-hidden? [:tabs-hidden?]] tabs-hidden? [:tabs-hidden?]]
[view st/chats-container [react/view st/chats-container
(cond (cond
edit? [toolbar-edit] edit? [toolbar-edit]
search? [toolbar-search] search? [toolbar-search]
:else [toolbar-view]) :else [toolbar-view])
[list-view {:dataSource (to-datasource chats) [react/list-view {:dataSource (to-datasource chats)
:renderRow (fn [[id :as row] _ _] :renderRow (fn [[id :as row] _ _]
(list-item ^{:key id} [chat-list-item row edit?])) (react/list-item ^{:key id} [chat-list-item row edit?]))
:renderHeader (when-not (empty? chats) renderers/list-header-renderer) :renderHeader (when-not (empty? chats) renderers/list-header-renderer)
:renderFooter (when-not (empty? chats) :renderFooter (when-not (empty? chats)
#(list-item [view #(react/list-item [react/view
[common/list-footer] [common/list-footer]
[common/bottom-shadow]])) [common/bottom-shadow]]))
:renderSeparator renderers/list-separator-renderer :renderSeparator renderers/list-separator-renderer
:style (st/list-container tabs-hidden?)}] :style (st/list-container tabs-hidden?)}]
(when (and (not edit?) (when (and (not edit?)
(not search?) (not search?)
(get-in platform-specific [:chats :action-button?])) (get-in platform-specific [:chats :action-button?]))

View File

@ -6,7 +6,7 @@
[status-im.components.icons.vector-icons :as vi] [status-im.components.icons.vector-icons :as vi]
[status-im.components.native-action-button :refer [native-action-button [status-im.components.native-action-button :refer [native-action-button
native-action-button-item]] native-action-button-item]]
[status-im.components.toolbar-new.view :refer [toolbar]] [status-im.components.toolbar-new.view :as toolbar]
[status-im.components.toolbar-new.actions :as act] [status-im.components.toolbar-new.actions :as act]
[status-im.components.drawer.view :refer [open-drawer]] [status-im.components.drawer.view :refer [open-drawer]]
[status-im.components.icons.custom-icons :refer [ion-icon]] [status-im.components.icons.custom-icons :refer [ion-icon]]
@ -31,14 +31,17 @@
(act/opts (if ios? toolbar-options (rest toolbar-options)))]) (act/opts (if ios? toolbar-options (rest toolbar-options)))])
(defn toolbar-view [] (defn toolbar-view []
[toolbar {:title (label :t/contacts) [toolbar/toolbar2 {}
:nav-action (act/hamburger open-drawer) [toolbar/nav-button (act/hamburger open-drawer)]
:actions (toolbar-actions)}]) [toolbar/content-title (label :t/contacts)]
[toolbar/actions
(toolbar-actions)]])
(defn toolbar-edit [] (defn toolbar-edit []
[toolbar {:nav-action (act/back #(dispatch [:set-in [:contacts/ui-props :edit?] false])) [toolbar/toolbar2 {}
:actions [{:image :blank}] [toolbar/nav-button (act/back #(dispatch [:set-in [:contacts/ui-props :edit?] false]))]
:title (label :t/edit-contacts)}]) [toolbar/content-title (label :t/edit-contacts)]
[toolbar/actions [{:image :blank}]]])
(defn contact-options [{:keys [unremovable?] :as contact} group] (defn contact-options [{:keys [unremovable?] :as contact} group]
(let [delete-contact-opt {:value #(u/show-confirmation (let [delete-contact-opt {:value #(u/show-confirmation

View File

@ -34,17 +34,18 @@
{:container-style wallet-styles/toolbar-title-icon {:container-style wallet-styles/toolbar-title-icon
:color :white}]]]) :color :white}]]])
(defn toolbar-buttons [] (def transaction-history-action
[rn/view {:style wallet-styles/toolbar-buttons-container} {:icon :icons/transaction-history
[vi/touchable-icon :icons/dots-vertical (merge {:color :white} wallet-styles/toolbar-icon) show-not-implemented!] :icon-opts (merge {:color :white :style {:viewBox "-108 65.9 24 24"}} wallet-styles/toolbar-icon)
[vi/touchable-icon :icons/transaction-history (merge {:color :white :style {:viewBox "-108 65.9 24 24"}} wallet-styles/toolbar-icon) :handler #(rf/dispatch [:navigate-to-modal :wallet-transactions])})
#(rf/dispatch [:navigate-to-modal :wallet-transactions])]])
(defn toolbar-view [] (defn toolbar-view []
[toolbar/toolbar2 {:style wallet-styles/toolbar} [toolbar/toolbar2 {:style wallet-styles/toolbar}
[toolbar/nav-button (act/hamburger-white drawer/open-drawer)] [toolbar/nav-button (act/hamburger-white drawer/open-drawer)]
[toolbar-title] [toolbar-title]
[toolbar-buttons]]) [toolbar/actions
[(assoc (act/opts [{:text (i18n/label :t/wallet-settings) :value show-not-implemented!}]) :icon-opts {:color :white})
transaction-history-action]]])
(defn error-message-view [error-message] (defn error-message-view [error-message]
[rn/view {:style wallet-styles/wallet-error-container} [rn/view {:style wallet-styles/wallet-error-container}