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