File tree 7 files changed +164
-1
lines changed
components/settings/category
status_im2/contexts/quo_preview
7 files changed +164
-1
lines changed Original file line number Diff line number Diff line change
1
+ (ns quo2.components.settings.category.component-spec
2
+ (:require [test-helpers.component :as h]
3
+ [quo2.components.settings.category.view :as category]))
4
+
5
+ (h/describe " category tests"
6
+ (h/test " category label renders"
7
+ (h/render [category/category
8
+ {:label " label"
9
+ :data [{:title " Item 1"
10
+ :left-icon :i/browser
11
+ :chevron? true }]}])
12
+ (h/is-truthy (h/get-by-text " label" )))
13
+
14
+ (h/test " category item renders"
15
+ (h/render [category/category
16
+ {:label " label"
17
+ :data [{:title " Item 1"
18
+ :left-icon :i/browser
19
+ :chevron? true }]}])
20
+ (h/is-truthy (h/get-by-text " Item 1" ))))
Original file line number Diff line number Diff line change
1
+ (ns quo2.components.settings.category.style
2
+ (:require [quo2.foundations.colors :as colors]))
3
+
4
+ (def container
5
+ {:left 0
6
+ :right 0
7
+ :padding-horizontal 20
8
+ :padding-top 12
9
+ :padding-bottom 8 })
10
+
11
+ (defn items
12
+ [theme blur?]
13
+ {:margin-top 12
14
+ :border-radius 16
15
+ :background-color (if blur?
16
+ colors/white-opa-5
17
+ (colors/theme-colors colors/white colors/neutral-95 theme))
18
+ :border-width 1
19
+ :border-color (if blur?
20
+ colors/white-opa-5
21
+ (colors/theme-colors colors/neutral-10 colors/neutral-80 theme))})
22
+
23
+ (defn separator
24
+ [theme blur?]
25
+ {:height 1
26
+ :background-color (if blur?
27
+ colors/white-opa-5
28
+ (colors/theme-colors colors/neutral-10 colors/neutral-80 theme))})
29
+
30
+ (defn blur-container
31
+ []
32
+ {:position :absolute
33
+ :left 0
34
+ :right 0
35
+ :bottom 0
36
+ :top 0
37
+ :overflow :hidden })
38
+
39
+ (defn blur-view
40
+ []
41
+ {:style {:flex 1 }
42
+ :blur-radius 10
43
+ :blur-type (colors/theme-colors :light :dark )
44
+ :blur-amount 20 })
Original file line number Diff line number Diff line change
1
+ (ns quo2.components.settings.category.view
2
+ (:require
3
+ [quo2.components.markdown.text :as text]
4
+ [quo2.components.settings.settings-list.view :as settings-list]
5
+ [quo2.foundations.colors :as colors]
6
+ [react-native.blur :as blur]
7
+ [react-native.core :as rn]
8
+ [quo2.components.settings.category.style :as style]
9
+ [quo2.theme :as quo.theme]))
10
+
11
+ (defn- category-internal
12
+ [{:keys [label data blur? theme]}]
13
+ [rn/view {:style style/container}
14
+ (when blur?
15
+ [rn/view (style/blur-container ) [blur/view (style/blur-view )]])
16
+ [text/text
17
+ {:weight :medium
18
+ :size :paragraph-2
19
+ :style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}}
20
+ label]
21
+ [rn/flat-list
22
+ {:data data
23
+ :style (style/items theme blur?)
24
+ :render-fn (fn [item] [settings-list/settings-list item])
25
+ :separator [rn/view {:style (style/separator theme blur?)}]}]])
26
+
27
+ (def category (quo.theme/with-theme category-internal))
Original file line number Diff line number Diff line change 82
82
quo2.components.settings.privacy-option
83
83
quo2.components.settings.reorder-item.view
84
84
quo2.components.settings.settings-list.view
85
+ quo2.components.settings.category.view
85
86
quo2.components.share.qr-code.view
86
87
quo2.components.share.share-qr-code.view
87
88
quo2.components.tabs.account-selector
231
232
(def account quo2.components.settings.accounts.view /account )
232
233
(def settings-list quo2.components.settings.settings-list.view /settings-list )
233
234
(def reorder-item quo2.components.settings.reorder-item.view /reorder-item )
235
+ (def category quo2.components.settings.category.view /category )
234
236
235
237
; ;;; SHARE
236
238
(def qr-code quo2.components.share.qr-code.view /qr-code )
Original file line number Diff line number Diff line change 37
37
[quo2.components.selectors.selectors.component-spec]
38
38
[quo2.components.settings.reorder-item.component-spec]
39
39
[quo2.components.settings.settings-list.component-spec]
40
+ [quo2.components.settings.category.component-spec]
40
41
[quo2.components.share.share-qr-code.component-spec]
41
42
[quo2.components.tags.--tests--.status-tags-component-spec]))
Original file line number Diff line number Diff line change 95
95
[status-im2.contexts.quo-preview.wallet.network-amount :as network-amount]
96
96
[status-im2.contexts.quo-preview.wallet.network-breakdown :as network-breakdown]
97
97
[status-im2.contexts.quo-preview.wallet.token-overview :as token-overview]
98
+ [status-im2.contexts.quo-preview.settings.category :as category]
98
99
[status-im2.contexts.quo-preview.keycard.keycard :as keycard]
99
100
[status-im2.contexts.quo-preview.loaders.skeleton :as skeleton]
100
101
[status-im2.contexts.quo-preview.community.channel-actions :as channel-actions]))
330
331
:component settings-list/preview-settings-list}
331
332
{:name :reorder-item
332
333
:options {:topBar {:visible true }}
333
- :component reorder-item/preview-reorder-item}]
334
+ :component reorder-item/preview-reorder-item}
335
+ {:name :category
336
+ :options {:topBar {:visible true }}
337
+ :component category/preview}]
334
338
:share [{:name :qr-code
335
339
:options {:topBar {:visible true }}
336
340
:component qr-code/preview-qr-code}
Original file line number Diff line number Diff line change
1
+ (ns status-im2.contexts.quo-preview.settings.category
2
+ (:require
3
+ [quo2.core :as quo]
4
+ [quo2.foundations.colors :as colors]
5
+ [quo2.theme :as theme]
6
+ [react-native.core :as rn]
7
+ [react-native.fast-image :as fast-image]
8
+ [reagent.core :as reagent]
9
+ [status-im2.contexts.quo-preview.preview :as preview]))
10
+
11
+ (def item
12
+ {:title " Item 1"
13
+ :left-icon :i/browser
14
+ :chevron? true })
15
+
16
+ (def descriptor
17
+ [{:label " Category label:"
18
+ :key :label
19
+ :type :text }
20
+ {:label " Category size:"
21
+ :key :size
22
+ :type :text }
23
+ {:label " Blur:"
24
+ :key :blur?
25
+ :type :boolean }])
26
+
27
+ (def image-uri
28
+ " https://4kwallpapers.com/images/wallpapers/giau-pass-mountain-pass-italy-dolomites-landscape-mountain-750x1334-4282.jpg" )
29
+
30
+ (def label " Label" )
31
+
32
+ (defn preview
33
+ []
34
+ (let [state (reagent/atom {:label " Label"
35
+ :size " 5"
36
+ :blur? false })
37
+ {:keys [width height]} (rn/get-window )]
38
+ [:f>
39
+ (fn []
40
+ (let [data (repeat (js/parseInt (:size @state)) item)]
41
+ (rn/use-effect (fn []
42
+ (if (:blur? @state)
43
+ (theme/set-theme :dark )
44
+ (theme/set-theme :light )))
45
+ [(:blur? @state)])
46
+ [rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
47
+ [rn/view
48
+ {:style {:flex 1
49
+ :padding-bottom 150
50
+ :margin-bottom 50
51
+ :background-color (colors/theme-colors colors/neutral-5 colors/neutral-95)}}
52
+ [rn/view
53
+ {:style {:min-height 180
54
+ :z-index 1 }} [preview/customizer state descriptor]]
55
+ (when (:blur? @state)
56
+ [fast-image/fast-image
57
+ {:source {:uri image-uri}
58
+ :style {:width width
59
+ :height height
60
+ :position :absolute }}])
61
+ [rn/view
62
+ {:style {:background-color (if (:blur? @state)
63
+ colors/neutral-80-opa-80
64
+ (colors/theme-colors colors/neutral-5 colors/neutral-95))}}
65
+ [quo/category {:label (:label @state) :data data :blur? (:blur? @state)}]]]]))]))
You can’t perform that action at this time.
0 commit comments