mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 02:35:54 +00:00
fixed icon fn definition
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
9a02bca975
commit
b9cbb28663
@ -27,8 +27,9 @@
|
||||
(def defs (get-class "Defs"))
|
||||
(def circle (get-class "Circle")))
|
||||
|
||||
(if platform/desktop?
|
||||
(def icons {:icons/discover (js/require "./resources/icons/bottom/discover_gray.svg")
|
||||
(def icons
|
||||
(if platform/desktop?
|
||||
{:icons/discover (js/require "./resources/icons/bottom/discover_gray.svg")
|
||||
:icons/contacts (js/require "./resources/icons/bottom/contacts_gray.svg")
|
||||
:icons/home (js/require "./resources/icons/bottom/home_gray.svg")
|
||||
:icons/home-active (js/require "./resources/icons/bottom/home_blue.svg")
|
||||
@ -88,8 +89,8 @@
|
||||
:icons/camera (js/require "./resources/icons/camera.svg")
|
||||
:icons/check (js/require "./resources/icons/check.svg")
|
||||
:icons/dots (js/require "./resources/icons/dots.svg")
|
||||
:icons/warning (js/require "./resources/icons/warning.svg")})
|
||||
(def icons {:icons/discover (components.svg/slurp-svg "./resources/icons/bottom/discover_gray.svg")
|
||||
:icons/warning (js/require "./resources/icons/warning.svg")}
|
||||
{:icons/discover (components.svg/slurp-svg "./resources/icons/bottom/discover_gray.svg")
|
||||
:icons/contacts (components.svg/slurp-svg "./resources/icons/bottom/contacts_gray.svg")
|
||||
:icons/home (components.svg/slurp-svg "./resources/icons/bottom/home_gray.svg")
|
||||
:icons/home-active (components.svg/slurp-svg "./resources/icons/bottom/home_blue.svg")
|
||||
@ -156,23 +157,20 @@
|
||||
(if platform/ios? :icons/dots-horizontal :icons/dots-vertical)
|
||||
n))
|
||||
|
||||
(if platform/desktop?
|
||||
(do (def default-viewbox {:width 24 :height 24})
|
||||
|
||||
(defn icon
|
||||
([name] (icon name nil))
|
||||
([name {:keys [color container-style style accessibility-label width height]
|
||||
(defn desktop-icon
|
||||
[name {:keys [color container-style style accessibility-label width height]
|
||||
:or {accessibility-label :icon}}]
|
||||
(let [icon-style (if width
|
||||
(let [default-viewbox {:width 24 :height 24}
|
||||
icon-style (if width
|
||||
(assoc default-viewbox :width width :height height)
|
||||
default-viewbox)]
|
||||
[react/view {:style container-style
|
||||
:accessibility-label accessibility-label}
|
||||
[react/image {:source (get icons (normalize-property-name name))
|
||||
:style (merge icon-style style)}]]))))
|
||||
(do (defn icon
|
||||
([name] (icon name nil))
|
||||
([name {:keys [color container-style style accessibility-label width height]
|
||||
:style (merge icon-style style)}]]))
|
||||
|
||||
(defn mobile-icon
|
||||
[name {:keys [color container-style style accessibility-label width height]
|
||||
:or {accessibility-label :icon}}]
|
||||
^{:key name}
|
||||
[react/view {:style container-style
|
||||
@ -196,4 +194,10 @@
|
||||
(if width
|
||||
(update icon-vec 1 assoc :width width :height height)
|
||||
icon-vec))
|
||||
(throw (js/Error. (str "Unknown icon: " name))))]))))
|
||||
(throw (js/Error. (str "Unknown icon: " name))))])
|
||||
|
||||
(defn icon
|
||||
([name] (icon name nil))
|
||||
([name options]
|
||||
(let [icon-fn (if platform/desktop? desktop-icon mobile-icon)]
|
||||
[icon-fn name options])))
|
Loading…
x
Reference in New Issue
Block a user