[#5839] fix logo on welcome screen on desktop

Signed-off-by: Dmitry Novotochinov <dmitry.novot@gmail.com>
This commit is contained in:
Dmitry Novotochinov 2018-10-19 00:43:21 +03:00
parent 5986761210
commit 83a92aa4b0
No known key found for this signature in database
GPG Key ID: 43D1DAF5AD39C927
1 changed files with 22 additions and 19 deletions

View File

@ -180,17 +180,34 @@
(if platform/ios? :icons/dots-horizontal :icons/dots-vertical) (if platform/ios? :icons/dots-horizontal :icons/dots-vertical)
n)) n))
(defn- match-color [color]
(cond
(keyword? color)
(case color
:dark colors/black
:gray colors/gray
:blue colors/blue
:active colors/blue
:white colors/white
:red colors/red
colors/black)
(string? color)
color
:else
colors/black))
(defn desktop-icon (defn desktop-icon
[name {:keys [color container-style style accessibility-label width height] [name {:keys [color container-style style accessibility-label width height]
:or {accessibility-label :icon}}] :or {accessibility-label :icon}}]
(let [default-viewbox {:width 24 :height 24} (let [default-viewbox {:width 24 :height 24}
icon-style (if width icon-style (if width
(assoc default-viewbox :width width :height height) (assoc default-viewbox :width width :height height)
default-viewbox)] default-viewbox)
color-style {:tint-color (match-color color)}]
[react/view {:style container-style [react/view {:style container-style
:accessibility-label accessibility-label} :accessibility-label accessibility-label}
[react/image {:source (get icons (normalize-property-name name)) [react/image {:source (get icons (normalize-property-name name))
:style (merge icon-style style)}]])) :style (merge icon-style color-style style)}]]))
(defn mobile-icon (defn mobile-icon
[name {:keys [color container-style accessibility-label width height] [name {:keys [color container-style accessibility-label width height]
@ -199,21 +216,7 @@
[react/animated-view {:style container-style [react/animated-view {:style container-style
:accessibility-label accessibility-label} :accessibility-label accessibility-label}
(if-let [icon-fn (get icons (normalize-property-name name))] (if-let [icon-fn (get icons (normalize-property-name name))]
(let [icon-vec (icon-fn (let [icon-vec (icon-fn (match-color color))]
(cond
(keyword? color)
(case color
:dark colors/black
:gray colors/gray
:blue colors/blue
:active colors/blue
:white colors/white
:red colors/red
colors/black)
(string? color)
color
:else
colors/black))]
(if width (if width
(update icon-vec 1 assoc :width width :height height) (update icon-vec 1 assoc :width width :height height)
icon-vec)) icon-vec))