[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

@ -96,8 +96,3 @@
:else
st/icon-dark-color))))
(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}})
(def item-text
(merge item
{:color st/color-blue4
:font-size 17}))
(def toolbar-text-action
(merge item
{:color st/color-blue4
:font-size 17}))
:font-size 17})
(def item-text-white-background {:color st/color-blue4})

View File

@ -29,7 +29,7 @@
([text] (nav-text text nil))
([text handler] (nav-text nil 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]))
(defn nav-clear-text
@ -52,14 +52,14 @@
;; Actions
(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])
(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]
[context-menu/context-menu
[rn/view tst/toolbar-action
[rn/view {:style (merge tst/item tst/toolbar-action)}
[vi/icon icon icon-opts]]
options
nil
@ -83,7 +83,7 @@
:else
[icon-action icon icon-opts handler])
{:key (str "action-" image)}))])
{:key (str "action-" (or image icon))}))])
(defn toolbar2
([title] (toolbar2 nil title))

View File

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

View File

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

View File

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

View File

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