|
| 1 | +(ns quo2.components.buttons.button.properties |
| 2 | + (:require [quo2.foundations.colors :as colors])) |
| 3 | + |
| 4 | +(defn custom-color-type |
| 5 | + [customization-color icon-only?] |
| 6 | + {:icon-color colors/white |
| 7 | + :icon-secondary-color colors/white-opa-70 |
| 8 | + :label-color colors/white |
| 9 | + :background-color (colors/custom-color customization-color 50) |
| 10 | + :border-radius (when icon-only? 24)}) |
| 11 | + |
| 12 | +(defn grey-photo |
| 13 | + [theme pressed?] |
| 14 | + {:icon-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 15 | + :icon-secondary-color (colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-70 theme) |
| 16 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 17 | + :icon-background-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme) |
| 18 | + :blur-overlay-color (if pressed? |
| 19 | + (colors/theme-colors colors/white-opa-50 |
| 20 | + colors/neutral-80-opa-50 |
| 21 | + theme) |
| 22 | + (colors/theme-colors colors/white-opa-40 |
| 23 | + colors/neutral-80-opa-40 |
| 24 | + theme)) |
| 25 | + :blur-type (if (= theme :light) :light :dark)}) |
| 26 | + |
| 27 | +(defn grey-blur |
| 28 | + [theme pressed?] |
| 29 | + {:icon-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 30 | + :icon-secondary-color (colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-70 theme) |
| 31 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 32 | + :background-color (if pressed? |
| 33 | + (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme) |
| 34 | + (colors/theme-colors colors/neutral-80-opa-5 colors/white-opa-5 theme))}) |
| 35 | + |
| 36 | +(defn outline-blur |
| 37 | + [theme pressed?] |
| 38 | + {:icon-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 39 | + :icon-secondary-color (colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40 theme) |
| 40 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 41 | + :border-color (if pressed? |
| 42 | + (colors/theme-colors colors/neutral-80-opa-20 colors/white-opa-20 theme) |
| 43 | + (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme))}) |
| 44 | + |
| 45 | +(defn grey |
| 46 | + [theme pressed?] |
| 47 | + {:icon-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 48 | + :icon-secondary-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 49 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 50 | + :background-color (if pressed? |
| 51 | + (colors/theme-colors colors/neutral-20 colors/neutral-60 theme) |
| 52 | + (colors/theme-colors colors/neutral-10 colors/neutral-80 theme))}) |
| 53 | + |
| 54 | +(defn dark-grey |
| 55 | + [theme pressed?] |
| 56 | + {:icon-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 57 | + :icon-secondary-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 58 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 59 | + :background-color (if pressed? |
| 60 | + (colors/theme-colors colors/neutral-30 colors/neutral-60 theme) |
| 61 | + (colors/theme-colors colors/neutral-20 colors/neutral-90 theme))}) |
| 62 | + |
| 63 | +(defn outline |
| 64 | + [theme pressed?] |
| 65 | + {:icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 66 | + :icon-secondary-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 67 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 68 | + :border-color (if pressed? |
| 69 | + (colors/theme-colors colors/neutral-40 colors/neutral-60 theme) |
| 70 | + (colors/theme-colors colors/neutral-30 colors/neutral-70 theme))}) |
| 71 | + |
| 72 | +(defn ghost |
| 73 | + [theme pressed?] |
| 74 | + {:icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 75 | + :icon-secondary-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) |
| 76 | + :label-color (colors/theme-colors colors/neutral-100 colors/white theme) |
| 77 | + :background-color (when pressed? |
| 78 | + (colors/theme-colors colors/neutral-10 colors/neutral-80 theme))}) |
| 79 | + |
| 80 | +(defn black |
| 81 | + [pressed?] |
| 82 | + {:icon-color colors/white |
| 83 | + :label-color colors/white |
| 84 | + :background-color (if pressed? colors/neutral-80 colors/neutral-95)}) |
| 85 | + |
| 86 | +(defn get-values |
| 87 | + [{:keys [customization-color theme type background pressed? icon-only?]}] |
| 88 | + (cond |
| 89 | + (= type :primary) (custom-color-type customization-color icon-only?) |
| 90 | + (= type :positive) (custom-color-type customization-color icon-only?) |
| 91 | + (= type :danger) (custom-color-type customization-color icon-only?) |
| 92 | + ;; TODO Remove type blurred - https://github.com/status-im/status-mobile/issues/16535 |
| 93 | + (and (= :photo background) (= type :grey)) (grey-photo theme pressed?) |
| 94 | + ;; TODO Remove type blur-bg - https://github.com/status-im/status-mobile/issues/16535 |
| 95 | + (or (= type :blur-bg) |
| 96 | + (and (= :blur background) (= type :grey))) (grey-blur theme pressed?) |
| 97 | + (and (= :blur background) (= type :outline)) (outline-blur theme pressed?) |
| 98 | + (= type :grey) (grey theme pressed?) |
| 99 | + (= type :dark-grey) (dark-grey theme pressed?) |
| 100 | + (= type :outline) (outline theme pressed?) |
| 101 | + (= type :ghost) (ghost theme pressed?) |
| 102 | + ;; TODO: remove type shell - https://github.com/status-im/status-mobile/issues/16535 |
| 103 | + (or (= type :shell) (= type :black)) (black pressed?))) |
0 commit comments