|
3 | 3 | [quo.react-native :as rn]
|
4 | 4 | [quo.theme :as theme]
|
5 | 5 | [status-im.ui.components.icons.icons :as icons]
|
6 |
| - [quo2.components.text :as text])) |
7 |
| - |
8 |
| -(def themes {:light {:background-color colors/neutral-20} |
9 |
| - :dark {:background-color colors/neutral-80}}) |
| 6 | + [quo2.components.tag :as tag])) |
10 | 7 |
|
11 | 8 | (defn get-value-from-size [size big-option small-option]
|
12 | 9 | (if (= size :big) big-option small-option))
|
13 | 10 |
|
14 |
| -(defn style-container [size border-color is-required] |
15 |
| - (merge {:height 32 |
16 |
| - :min-width (get-value-from-size size 94 76) |
17 |
| - :align-items :center |
18 |
| - :flex-direction :row |
19 |
| - :left 0 |
20 |
| - :border-radius 100 |
21 |
| - :padding-right 10} |
22 |
| - (when is-required {:border-color border-color |
23 |
| - :border-width 1}))) |
| 11 | +(def icon-container-styles {:display :flex |
| 12 | + :align-items :center |
| 13 | + :justify-content :center |
| 14 | + :position :absolute |
| 15 | + :border-radius 100 |
| 16 | + :margin-left 2}) |
24 | 17 |
|
25 | 18 | (defn token-tag
|
26 | 19 | "[token-tag opts \"label\"]
|
|
29 | 22 | :token string
|
30 | 23 | :value string
|
31 | 24 | :size :small/:big
|
32 |
| - :icon-name :icon-name |
33 |
| - :required-icon :icon-name |
| 25 | + :token-img-src :token-img-src |
34 | 26 | :border-color :color
|
35 | 27 | :is-required true/false
|
36 | 28 | :is-purchasable true/false
|
37 | 29 | }"
|
38 | 30 | [_ _]
|
39 |
| - (fn [{:keys [token value size icon-name border-color is-required is-purchasable required-icon] |
40 |
| - :or {size :small border-color (if (= (theme/get-theme) :dark) colors/purple-60 colors/purple-50) required-icon (if (= (theme/get-theme) :dark) :main-icons2/required-checkmark-dark :main-icons2/required-checkmark)}}] |
41 |
| - [rn/view {:style (merge (style-container size border-color is-required) (get themes (theme/get-theme)))} |
42 |
| - [rn/view {:style {:margin-left 2 |
43 |
| - :margin-right (get-value-from-size size 8 6)}} |
44 |
| - [icons/icon icon-name {:no-color true |
45 |
| - :size 24}]] |
46 |
| - [text/text {:weight :medium |
47 |
| - :number-of-lines 1 |
48 |
| - :size (get-value-from-size size :paragraph-2 :label) |
49 |
| - :padding 2 |
50 |
| - :padding-top 12 |
51 |
| - :margin-right (get-value-from-size size 12 10)} value " " token] |
52 |
| - (when (or is-required is-purchasable) [rn/view {:style {:display :flex |
53 |
| - :align-items :center |
54 |
| - :justify-content :center |
55 |
| - :position :absolute |
56 |
| - :background-color (if is-required border-color colors/neutral-50) |
57 |
| - :border-radius 100 |
58 |
| - :right -20 |
59 |
| - :bottom 16 |
60 |
| - :margin-left 2 |
61 |
| - :margin-right (get-value-from-size size 8 6)}} |
62 |
| - (when (and is-required required-icon) [icons/icon required-icon {:no-color true |
63 |
| - :size 4}]) |
64 |
| - (when is-purchasable [icons/icon (if (= (theme/get-theme) :dark) :main-icons2/purchasable-dark :main-icons2/purchasable) {:no-color true |
65 |
| - :size 4}])])])) |
| 31 | + (fn [{:keys [token value size token-img-src border-color is-required is-purchasable] |
| 32 | + :or {size :small border-color (if (= (theme/get-theme) :dark) colors/purple-60 colors/purple-50)}}] |
| 33 | + |
| 34 | + [tag/tag {:size size |
| 35 | + :token-img-src token-img-src |
| 36 | + :border-color (when is-required border-color) |
| 37 | + :text-value (str value " " token) |
| 38 | + :overlay |
| 39 | + (when (or is-required is-purchasable) [rn/view {:style (merge icon-container-styles {:width 14 |
| 40 | + :height 14 |
| 41 | + :background-color border-color |
| 42 | + :border-color (if (= (theme/get-theme) :dark) colors/black colors/white) |
| 43 | + :border-width 1 |
| 44 | + :right (get-value-from-size size -3 -5) |
| 45 | + :bottom (get-value-from-size size (- 32 7 (if is-required 5 4)) (- 24 7 (if is-required 4 2))) ; (- height (icon-height/2) spacing) |
| 46 | + })} |
| 47 | + [icons/icon (if is-required :main-icons2/required-checkmark12 :main-icons2/purchasable12) {:no-color true |
| 48 | + :width (if is-required 6 12) |
| 49 | + :height (if is-required 6 12)}]])}])) |
0 commit comments