Fixed incorrect margin for toolbar action buttons

This commit is contained in:
Julien Eluard 2017-09-08 19:22:48 +02:00 committed by Roman Volosovskyi
parent 2af025abc3
commit 3e1d731111
5 changed files with 29 additions and 29 deletions

View File

@ -1,9 +1,9 @@
(ns status-im.components.icons.vector-icons (ns status-im.components.icons.vector-icons
(:require-macros [status-im.utils.slurp :refer [slurp-svg]]) (:require-macros [status-im.utils.slurp :refer [slurp-svg]])
(:require [reagent.core :as r] (:require [reagent.core :as reagent]
[status-im.utils.platform :refer [ios?]] [status-im.utils.platform :as platform]
[status-im.components.styles :as st] [status-im.components.styles :as styles]
[status-im.components.react :as rn] [status-im.components.react :as react]
[status-im.react-native.js-dependencies :as rn-dependencies])) [status-im.react-native.js-dependencies :as rn-dependencies]))
(defn get-property [name] (defn get-property [name]
@ -11,7 +11,7 @@
(defn adapt-class [class] (defn adapt-class [class]
(when class (when class
(r/adapt-react-class class))) (reagent/adapt-react-class class)))
(defn get-class [name] (defn get-class [name]
(adapt-class (get-property name))) (adapt-class (get-property name)))
@ -67,7 +67,7 @@
(defn normalize-property-name [n] (defn normalize-property-name [n]
(if (= n :icons/options) (if (= n :icons/options)
(if ios? :icons/dots-horizontal :icons/dots-vertical) (if platform/ios? :icons/dots-horizontal :icons/dots-vertical)
n)) n))
(def default-viewbox {:width 24 :height 24 :viewBox "0 0 24 24"}) (def default-viewbox {:width 24 :height 24 :viewBox "0 0 24 24"})
@ -75,7 +75,7 @@
(defn icon (defn icon
([name] (icon name nil)) ([name] (icon name nil))
([name {:keys [color container-style style]}] ([name {:keys [color container-style style]}]
[rn/view container-style [react/view {:style container-style}
(if-let [icon-fn (get icons (normalize-property-name name))] (if-let [icon-fn (get icons (normalize-property-name name))]
(into [] (into []
(concat (concat
@ -84,15 +84,15 @@
(cond (cond
(keyword? color) (keyword? color)
(case color (case color
:dark st/icon-dark-color :dark styles/icon-dark-color
:gray st/icon-gray-color :gray styles/icon-gray-color
:blue st/color-light-blue :blue styles/color-light-blue
:active st/color-blue4 :active styles/color-blue4
:white st/color-white :white styles/color-white
:red st/icon-red-color :red styles/icon-red-color
st/icon-dark-color) styles/icon-dark-color)
(string? color) (string? color)
color color
:else :else
st/icon-dark-color)))) styles/icon-dark-color))))
(throw (js/Error. (str "Unknown icon: " name))))])) (throw (js/Error. (str "Unknown icon: " name))))]))

View File

@ -90,8 +90,8 @@
:padding-horizontal 16}) :padding-horizontal 16})
(defstyle item (defstyle item
{:ios {:margin-horizontal 12 {:ios {:marginHorizontal 12
:margin-vertical 16} :marginVertical 16}
:android {:margin 16}}) :android {:margin 16}})
(def item-text (def item-text

View File

@ -61,16 +61,15 @@
(defn- option-actions [icon icon-opts options] (defn- option-actions [icon icon-opts options]
[context-menu/context-menu [context-menu/context-menu
[rn/view {:style (merge tst/item tst/toolbar-action)} [rn/view {:style tst/toolbar-action}
[vi/icon icon icon-opts]] [vi/icon icon icon-opts]]
options options
nil nil
tst/item]) tst/item])
(defn- icon-action [icon icon-opts handler] (defn- icon-action [icon icon-opts handler]
[rn/touchable-highlight {:style tst/item [rn/touchable-highlight {:on-press handler}
:on-press handler} [rn/view {:style (merge tst/item tst/toolbar-action)}
[rn/view {:style tst/toolbar-action}
[vi/icon icon icon-opts]]]) [vi/icon icon icon-opts]]])
(defn actions [v] (defn actions [v]

View File

@ -56,7 +56,9 @@
[react/text {:style (if pos-change? [react/text {:style (if pos-change?
wallet-styles/today-variation-positive wallet-styles/today-variation-positive
wallet-styles/today-variation-negative)} wallet-styles/today-variation-negative)}
(str (if pos-change? "+" "-") change)]])) (if change
(str (when pos-change? "+") change "%")
"-%")]]))
(defn main-section [usd-value change error-message] (defn main-section [usd-value change error-message]
[react/view {:style wallet-styles/main-section} [react/view {:style wallet-styles/main-section}

View File

@ -47,11 +47,10 @@
:<- [:price] :<- [:price]
:<- [:last-day] :<- [:last-day]
(fn [[price last-day]] (fn [[price last-day]]
(if (and price last-day) (when (and price last-day)
(-> (money/percent-change price last-day) (-> (money/percent-change price last-day)
(money/with-precision 2) (money/with-precision 2)
(str "%")) .toNumber))))
"-%")))
(reg-sub :prices-loading? (reg-sub :prices-loading?
(fn [db] (fn [db]