Commit 2e63ee8 1 parent a218499 commit 2e63ee8 Copy full SHA for 2e63ee8
File tree 8 files changed +151
-9
lines changed
status_im2/contexts/quo_preview
8 files changed +151
-9
lines changed Original file line number Diff line number Diff line change 3
3
[quo2.components.markdown.text :as text]
4
4
[quo2.components.common.notification-dot.view :as notification-dot]
5
5
[quo2.components.tabs.tab.style :as style]
6
- [quo2.theme :as theme]
6
+ [quo2.theme :as quo. theme]
7
7
[react-native.core :as rn]
8
8
[react-native.svg :as svg]))
9
9
47
47
(vector? children)
48
48
children)])
49
49
50
- (defn- themed- view
50
+ (defn- view-internal
51
51
[{:keys [accessibility-label
52
52
active
53
53
before
104
104
:disabled disabled
105
105
:background-color background-color}])]]))
106
106
107
- (def view (theme/with-theme themed- view))
107
+ (def view (quo. theme/with-theme view-internal ))
Original file line number Diff line number Diff line change
1
+ (ns quo2.components.tags.network-tags.component-spec
2
+ (:require [quo2.components.tags.network-tags.view :as network-tags]
3
+ [test-helpers.component :as h]))
4
+
5
+ (h/describe " network-tags component"
6
+ (h/test " renders network tags with single network"
7
+ (h/render [network-tags/view
8
+ {:title " Network Tags"
9
+ :networks [{:source " network-icon.png" }]}])
10
+ (h/is-truthy (h/get-by-text " Network Tags" )))
11
+
12
+ (h/test " renders network tags with multiple networks"
13
+ (h/render [network-tags/view
14
+ {:title " Multiple Networks"
15
+ :networks [{:source " network-icon1.png" }
16
+ {:source " network-icon2.png" }
17
+ {:source " network-icon3.png" }]
18
+ :size :size/s-32 }])
19
+ (h/is-truthy (h/get-by-text " Multiple Networks" ))))
Original file line number Diff line number Diff line change
1
+ (ns quo2.components.tags.network-tags.style
2
+ (:require [quo2.foundations.colors :as colors]))
3
+
4
+ (defn container
5
+ [{:keys [status theme blur?]}]
6
+ {:flex-direction :row
7
+ :align-self :flex-start
8
+ :background-color (when (= status :error )
9
+ (colors/theme-colors
10
+ (colors/custom-color :danger 50 10 )
11
+ (colors/custom-color :danger 60 10 )
12
+ theme))
13
+ :border-width 1
14
+ :border-color (cond (= status :error )
15
+ (colors/theme-colors
16
+ (colors/custom-color :danger 50 20 )
17
+ (colors/custom-color :danger 60 20 )
18
+ theme)
19
+ (and blur? (= status :default )) (colors/theme-colors
20
+ colors/neutral-80-opa-5
21
+ colors/white-opa-5
22
+ theme)
23
+ :else (colors/theme-colors
24
+ colors/neutral-20
25
+ colors/neutral-80
26
+ theme))
27
+ :border-radius 8
28
+ :padding-left 5
29
+ :padding-right 5
30
+ :padding-top 3
31
+ :padding-bottom 2 })
32
+
33
+ (defn title-style
34
+ [{:keys [status theme]}]
35
+ {:padding-left 4
36
+ :margin-top -1
37
+ :color (when (= status :error )
38
+ (colors/theme-colors
39
+ (colors/custom-color :danger 50 )
40
+ (colors/custom-color :danger 60 )
41
+ theme))})
Original file line number Diff line number Diff line change
1
+ (ns quo2.components.tags.network-tags.view
2
+ (:require [quo2.components.list-items.preview-list.view :as preview-list]
3
+ [quo2.components.tags.network-tags.style :as style]
4
+ [quo2.components.markdown.text :as text]
5
+ [react-native.core :as rn]
6
+ [quo2.theme :as quo.theme]))
7
+
8
+ (defn- view-internal
9
+ [{:keys [title networks status theme blur?] :or {status :default }}]
10
+ [rn/view
11
+ {:style (style/container {:status status
12
+ :theme theme
13
+ :blur? blur?})}
14
+ [preview-list/view
15
+ {:type :network
16
+ :number (count networks)
17
+ :size :size/s-16 } networks]
18
+ [text/text
19
+ {:weight :medium
20
+ :size :paragraph-2
21
+ :style (style/title-style {:status status
22
+ :theme theme})}
23
+ title]])
24
+
25
+ (def view (quo.theme/with-theme view-internal))
Original file line number Diff line number Diff line change 107
107
quo2.components.tabs.segmented-tab
108
108
quo2.components.tabs.tabs.view
109
109
quo2.components.tags.context-tag.view
110
+ quo2.components.tags.network-tags.view
110
111
quo2.components.tags.number-tag.view
111
112
quo2.components.tags.permission-tag
112
113
quo2.components.tags.status-tags
311
312
(def account-selector quo2.components.tabs.account-selector /account-selector )
312
313
313
314
; ;;; Tags
314
- (def tag quo2.components.tags.tag /tag )
315
- (def tags quo2.components.tags.tags /tags )
315
+ (def context-tag quo2.components.tags.context-tag.view /view )
316
+ (def network-tags quo2.components.tags.network-tags.view /view )
317
+ (def number-tag quo2.components.tags.number-tag.view /view )
316
318
(def permission-tag quo2.components.tags.permission-tag /tag )
317
319
(def status-tag quo2.components.tags.status-tags /status-tag )
320
+ (def tag quo2.components.tags.tag /tag )
321
+ (def tags quo2.components.tags.tags /tags )
318
322
(def token-tag quo2.components.tags.token-tag /tag )
319
- (def context-tag quo2.components.tags.context-tag.view /view )
320
- (def number-tag quo2.components.tags.number-tag.view /view )
321
323
322
324
; ;;; Text combinations
323
325
(def text-combinations quo2.components.text-combinations.view /view )
Original file line number Diff line number Diff line change 58
58
[quo2.components.settings.category.component-spec]
59
59
[quo2.components.settings.data-item.component-spec]
60
60
[quo2.components.share.share-qr-code.component-spec]
61
+ [quo2.components.tags.network-tags.component-spec]
61
62
[quo2.components.tags.status-tags-component-spec]
62
63
[quo2.components.wallet.account-card.component-spec]
63
64
[quo2.components.wallet.account-overview.component-spec]
Original file line number Diff line number Diff line change 104
104
[status-im2.contexts.quo-preview.tabs.tabs :as tabs]
105
105
[status-im2.contexts.quo-preview.empty-state.empty-state :as empty-state]
106
106
[status-im2.contexts.quo-preview.tags.context-tags :as context-tags]
107
+ [status-im2.contexts.quo-preview.tags.network-tags :as network-tags]
107
108
[status-im2.contexts.quo-preview.tags.number-tag :as number-tag]
108
109
[status-im2.contexts.quo-preview.tags.permission-tag :as permission-tag]
109
110
[status-im2.contexts.quo-preview.tags.status-tags :as status-tags]
338
339
:component account-selector/preview-this}]
339
340
:tags [{:name :context-tags
340
341
:component context-tags/preview-context-tags}
342
+ {:name :network-tags
343
+ :component network-tags/preview}
341
344
{:name :number-tag
342
345
:component number-tag/preview}
343
- {:name :tags
344
- :component tags/preview-tags}
345
346
{:name :permission-tag
346
347
:component permission-tag/preview-permission-tag}
347
348
{:name :status-tags
348
349
:component status-tags/preview-status-tags}
350
+ {:name :tags
351
+ :component tags/preview-tags}
349
352
{:name :token-tag
350
353
:component token-tag/preview-token-tag}]
351
354
:text-combinations [{:name :text-combinations
Original file line number Diff line number Diff line change
1
+ (ns status-im2.contexts.quo-preview.tags.network-tags
2
+ (:require [quo2.core :as quo]
3
+ [quo2.foundations.resources :as resources]
4
+ [status-im2.contexts.quo-preview.preview :as preview]
5
+ [react-native.core :as rn]
6
+ [reagent.core :as reagent]))
7
+
8
+ (def community-networks
9
+ [[{:source (resources/get-network :ethereum )}]
10
+ [{:source (resources/get-network :arbitrum )}
11
+ {:source (resources/get-network :ethereum )}]
12
+ [{:source (resources/get-network :arbitrum )}
13
+ {:source (resources/get-network :optimism )}
14
+ {:source (resources/get-network :ethereum )}]])
15
+
16
+ (def descriptor
17
+ [{:type :select
18
+ :key :status
19
+ :options [{:key :error }
20
+ {:key :default }]}
21
+ {:type :text
22
+ :key :title }
23
+ {:type :select
24
+ :key :networks
25
+ :options [{:key 1 }
26
+ {:key 2 }
27
+ {:key 3 }]}
28
+ {:type :boolean
29
+ :key :blur? }])
30
+
31
+
32
+ (defn preview
33
+ []
34
+ (let [state (reagent/atom {:title " Tag"
35
+ :status :default
36
+ :networks 3 })]
37
+ (fn []
38
+ [preview/preview-container
39
+ {:state state
40
+ :descriptor descriptor
41
+ :blur? (:blur? @state)
42
+ :show-blur-background? true }
43
+ [rn/view
44
+ {:style {:align-self :center
45
+ :justify-content :center
46
+ :flex 1 }}
47
+ [quo/network-tags
48
+ {:networks (nth community-networks (dec (:networks @state)))
49
+ :status (:status @state)
50
+ :title (:title @state)
51
+ :blur? (:blur? @state)}]]])))
You can’t perform that action at this time.
0 commit comments