Skip to content

Commit d1f80f0

Browse files
authored
Rename quo.theme to quo.context (#22373)
1 parent 1f82e6d commit d1f80f0

File tree

340 files changed

+785
-783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+785
-783
lines changed

doc/ui-guidelines.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ NOW:
3131
(defn view
3232
[{:keys [on-press on-long-press icon]}]
3333
(let [[pressed? set-pressed] (rn/use-state false)
34-
theme (theme/use-theme)
34+
theme (context/use-theme)
3535
on-press-in (rn/use-callback #(set-pressed true))
3636
on-press-out (rn/use-callback #(set-pressed nil))]
3737
[rn/pressable

src/legacy/status_im/ui/components/chat_icon/screen.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
[legacy.status-im.ui.screens.chat.photos :as photos]
77
[legacy.status-im.ui.screens.profile.visibility-status.utils :as visibility-status-utils]
88
[quo.components.avatars.user-avatar.style :as user-avatar.style]
9+
[quo.context]
910
[quo.core :as quo]
10-
[quo.theme]
1111
[re-frame.core :as re-frame.core]
1212
[react-native.core :as rn]
1313
[status-im.contexts.profile.utils :as profile.utils]

src/legacy/status_im/ui/components/topbar.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(ns legacy.status-im.ui.components.topbar
22
(:require
33
[legacy.status-im.ui.components.core :as quo]
4+
[quo.context]
45
[quo.foundations.colors :as quo.colors]
5-
[quo.theme]
66
[re-frame.core :as re-frame]
77
[react-native.safe-area :as safe-area]))
88

@@ -33,7 +33,7 @@
3333
:or {border-bottom? true
3434
new-ui? false}
3535
:as props}]
36-
(let [theme (quo.theme/use-theme)
36+
(let [theme (quo.context/use-theme)
3737
navigation (if (= navigation :none)
3838
nil
3939
[(default-navigation modal? navigation)])]

src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
(:require
33
[legacy.status-im.ui.components.colors :as quo.colors]
44
[legacy.status-im.ui.screens.chat.message.legacy-style :as style]
5+
[quo.context]
56
[quo.core :as quo]
67
[quo.foundations.colors :as colors]
78
[quo.foundations.typography :as typography]
8-
[quo.theme]
99
[react-native.core :as rn]
1010
[status-im.constants :as constants]
1111
[status-im.contexts.chat.messenger.messages.delete-message-for-me.events]
@@ -126,7 +126,7 @@
126126
[{:keys [content chat-id]
127127
:as message-data}]
128128
(let [community-id (rf/sub [:community-id-by-chat-id chat-id])
129-
theme (quo.theme/use-theme)]
129+
theme (quo.context/use-theme)]
130130
(reduce (fn [acc e]
131131
(render-block message-data
132132
acc
@@ -145,7 +145,7 @@
145145
;; STATUS ? whats that ?
146146
(defmethod ->message constants/content-type-status
147147
[{:keys [content content-type]}]
148-
(let [theme (quo.theme/use-theme)]
148+
(let [theme (quo.context/use-theme)]
149149
[rn/view style/status-container
150150
[rn/text {:style (style/status-text)}
151151
(reduce

src/legacy/status_im/ui/screens/communities/members.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[legacy.status-im.ui.components.react :as react]
88
[legacy.status-im.ui.components.topbar :as topbar]
99
[legacy.status-im.ui.components.unviewed-indicator :as unviewed-indicator]
10-
[quo.theme]
10+
[quo.context]
1111
[react-native.core :as rn]
1212
[status-im.constants :as constants]
1313
[status-im.contexts.profile.utils :as profile.utils]
@@ -110,7 +110,7 @@
110110

111111
(defn view
112112
[]
113-
(let [{:keys [community-id]} (quo.theme/use-screen-params)]
113+
(let [{:keys [community-id]} (quo.context/use-screen-params)]
114114
(rn/use-mount
115115
#(rf/dispatch [:community/fetch-requests-to-join community-id]))
116116
(fn []

src/legacy/status_im/ui/screens/profile/user/views.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
(:require
33
[legacy.status-im.ui.components.core :as components]
44
[legacy.status-im.ui.components.list.item :as list.item]
5+
[quo.context]
56
[quo.core :as quo]
6-
[quo.theme]
77
[re-frame.core :as re-frame]
88
[react-native.core :as rn]
99
[utils.i18n :as i18n]

src/legacy/status_im/ui/screens/profile/visibility_status/utils.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
(:require
33
[legacy.status-im.ui.components.colors :as colors]
44
[legacy.status-im.ui.screens.profile.visibility-status.styles :as styles]
5+
[quo.context]
56
[quo.foundations.colors :as quo.colors]
6-
[quo.theme]
77
[status-im.constants :as constants]
88
[utils.datetime :as datetime]
99
[utils.i18n :as i18n]
@@ -71,7 +71,7 @@
7171
(defn icon-visibility-status-dot
7272
[public-key container-size]
7373
(let [status (rf/sub [:visibility-status-updates/visibility-status-update public-key])
74-
theme (quo.theme/use-theme)
74+
theme (quo.context/use-theme)
7575
size (icon-dot-size container-size)
7676
margin -2
7777
dot-color (icon-dot-color status)

src/quo/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,20 @@ Our goal is to make all design system components *themeable*, which means they
179179
should not use, nor fallback to the OS theme, because themes are *contextual*
180180
and can be overridden in specific parts of the app.
181181

182-
To achieve this, use the higher-order function `quo.theme/with-theme` to
182+
To achieve this, use the higher-order function `quo.context/with-theme` to
183183
automatically inject the current theme context (based on the [React Context
184184
API](https://react.dev/learn/passing-data-deeply-with-context)).
185185

186186
Use the following pattern:
187187

188188
```clojure
189189
(ns quo.components.<figma page>.<component name>.view
190-
(:require [quo.theme :as quo.theme]))
190+
(:require [quo.context :as quo.context]))
191191

192192
(defn- view-internal [{:keys [theme]}]
193193
...)
194194

195-
(def view (quo.theme/with-theme view-internal))
195+
(def view (quo.context/with-theme view-internal))
196196
```
197197

198198
Then pass the `theme` value down to all functions that may rely on the OS theme,
@@ -213,12 +213,12 @@ file.
213213
```clojure
214214
;; bad
215215
(ns ...
216-
(require [quo.theme :as quo.theme]
216+
(require [quo.context :as quo.context]
217217
[quo.core :as quo]))
218218

219219
;; good
220220
(ns ...
221-
(require [quo.theme :as quo.theme]
221+
(require [quo.context :as quo.context]
222222
[quo.core :as quo]))
223223
```
224224

src/quo/components/animated_header_flatlist/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[oops.core :as oops]
44
[quo.components.animated-header-flatlist.style :as style]
55
[quo.components.icon :as icon]
6+
[quo.context :as quo.context]
67
[quo.foundations.colors :as colors]
7-
[quo.theme :as quo.theme]
88
[react-native.core :as rn]
99
[react-native.fast-image :as fast-image]
1010
[react-native.platform :as platform]
@@ -54,7 +54,7 @@
5454

5555
(defn- f-animated-header-list
5656
[{:keys [header-comp main-comp back-button-on-press] :as params}]
57-
(let [theme (quo.theme/use-theme)
57+
(let [theme (quo.context/use-theme)
5858
window-height (:height (rn/get-window))
5959
{:keys [top bottom]} (safe-area/get-insets)
6060
;; view height calculation is different because window height is different on iOS and

src/quo/components/avatars/account_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(:require
33
[clojure.string :as string]
44
[quo.components.avatars.account-avatar.style :as style]
5-
[quo.theme :as quo.theme]
5+
[quo.context :as quo.context]
66
[react-native.core :as rn]))
77

88
(defn view
@@ -21,7 +21,7 @@
2121
:or {size style/default-size
2222
emoji "🍑"}
2323
:as opts}]
24-
(let [theme (quo.theme/use-theme)
24+
(let [theme (quo.context/use-theme)
2525
emoji-size (style/get-emoji-size size)]
2626
[rn/view
2727
{:accessible true

src/quo/components/avatars/channel_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
[quo.components.avatars.channel-avatar.style :as style]
55
[quo.components.icon :as icons]
66
[quo.components.markdown.text :as text]
7+
[quo.context :as quo.context]
78
[quo.foundations.colors :as colors]
8-
[quo.theme :as quo.theme]
99
[react-native.core :as rn]
1010
[utils.string]))
1111

@@ -53,7 +53,7 @@
5353
used to extract the initials.
5454
"
5555
[{:keys [size emoji customization-color locked? full-name]}]
56-
(let [theme (quo.theme/use-theme)]
56+
(let [theme (quo.context/use-theme)]
5757
[rn/view
5858
{:accessibility-label :channel-avatar
5959
:style (style/outer-container {:theme theme

src/quo/components/avatars/collection_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(ns quo.components.avatars.collection-avatar.view
22
(:require
33
[quo.components.avatars.collection-avatar.style :as style]
4-
[quo.theme :as quo.theme]
4+
[quo.context :as quo.context]
55
[react-native.core :as rn]
66
[react-native.fast-image :as fast-image]))
77

@@ -11,7 +11,7 @@
1111
:image - collection image
1212
:theme - keyword -> :light/:dark"
1313
[{:keys [image size on-load-start on-load-end on-error] :or {size :size-24}}]
14-
(let [theme (quo.theme/use-theme)]
14+
(let [theme (quo.context/use-theme)]
1515
[rn/view {:style (style/collection-avatar-container theme size)}
1616
[fast-image/fast-image
1717
{:accessibility-label :collection-avatar

src/quo/components/avatars/group_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[quo.components.avatars.group-avatar.style :as style]
44
[quo.components.icon :as icon]
55
[quo.components.markdown.text :as text]
6+
[quo.context :as quo.context]
67
[quo.foundations.colors :as colors]
7-
[quo.theme :as quo.theme]
88
[react-native.core :as rn]
99
[react-native.fast-image :as fast-image]))
1010

@@ -26,7 +26,7 @@
2626
customization-color :blue
2727
picture nil
2828
icon-name :i/members}}]
29-
(let [theme (quo.theme/use-theme)
29+
(let [theme (quo.context/use-theme)
3030
container-size (get-in sizes [size :container])
3131
icon-size (get-in sizes [size :icon])]
3232
[rn/view

src/quo/components/avatars/icon_avatar.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(ns quo.components.avatars.icon-avatar
22
(:require
33
[quo.components.icon :as icons]
4+
[quo.context :as quo.context]
45
[quo.foundations.colors :as colors]
5-
[quo.theme :as quo.theme]
66
[react-native.core :as rn]))
77

88
(def ^:private sizes
@@ -19,7 +19,7 @@
1919
[{:keys [size icon color opacity border? blur?]
2020
:or {opacity 20
2121
size :size-32}}]
22-
(let [theme (quo.theme/use-theme)
22+
(let [theme (quo.context/use-theme)
2323
{component-size :component icon-size :icon} (get sizes size)
2424
circle-color (colors/resolve-color color theme opacity)
2525
icon-color (colors/resolve-color color theme)]

src/quo/components/avatars/user_avatar/view.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[quo.components.avatars.user-avatar.style :as style]
55
[quo.components.common.no-flicker-image :as no-flicker-image]
66
[quo.components.markdown.text :as text]
7-
[quo.theme]
7+
[quo.context]
88
[react-native.core :as rn]
99
[react-native.fast-image :as fast-image]
1010
[schema.core :as schema]
@@ -14,7 +14,7 @@
1414
(defn initials-avatar
1515
[{:keys [full-name size customization-color]
1616
:or {customization-color :blue}}]
17-
(let [theme (quo.theme/use-theme)
17+
(let [theme (quo.context/use-theme)
1818
font-size (get-in style/sizes [size :font-size])
1919
amount-initials (if (#{:xs :xxs :xxxs} size) 1 2)]
2020
[rn/view
@@ -39,7 +39,7 @@
3939
online? true
4040
ring? true}
4141
:as props}]
42-
(let [theme (quo.theme/use-theme)
42+
(let [theme (quo.context/use-theme)
4343
picture-config (:config profile-picture)
4444
full-name (or full-name "Your Name")
4545
;; image generated with `profile-picture-fn` is round cropped

src/quo/components/avatars/wallet_user_avatar/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(:require [clojure.string :as string]
33
[quo.components.avatars.wallet-user-avatar.style :as style]
44
[quo.components.markdown.text :as text]
5-
[quo.theme :as quo.theme]
5+
[quo.context :as quo.context]
66
[react-native.core :as rn]
77
utils.string))
88

@@ -46,7 +46,7 @@
4646
:neutral? - boolean (default: false) - use neutral colors variant"
4747
[{:keys [full-name customization-color size monospace? lowercase? neutral? container-style]
4848
:or {size biggest-possible}}]
49-
(let [theme (quo.theme/use-theme)
49+
(let [theme (quo.context/use-theme)
5050
circle-size (:size (size properties))
5151
small? (check-if-size-small size)
5252
initials (utils.string/get-initials full-name (if small? 1 2))]

src/quo/components/banners/alert_banner/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
[quo.components.buttons.button.view :as button]
55
[quo.components.icon :as icon]
66
[quo.components.markdown.text :as text]
7+
[quo.context]
78
[quo.foundations.colors :as colors]
8-
[quo.theme]
99
[react-native.core :as rn]
1010
[react-native.linear-gradient :as linear-gradient]
1111
[schema.core :as schema]))
1212

1313
(defn- view-internal
1414
[{:keys [action? text button-text text-number-of-lines container-style on-button-press]}]
15-
(let [theme (quo.theme/use-theme)]
15+
(let [theme (quo.context/use-theme)]
1616
[rn/view
1717
{:accessibility-label :alert-banner
1818
:style (style/alert-banner-container theme)}

src/quo/components/banners/banner/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
[quo.components.counter.counter.view :as counter]
55
[quo.components.icon :as icons]
66
[quo.components.markdown.text :as text]
7+
[quo.context :as quo.context]
78
[quo.foundations.colors :as colors]
8-
[quo.theme :as quo.theme]
99
[react-native.core :as rn]))
1010

1111
(defn view
1212
[{:keys [hide-pin? latest-pin-text pins-count on-press]}]
13-
(let [theme (quo.theme/use-theme)]
13+
(let [theme (quo.context/use-theme)]
1414
(when (pos? pins-count)
1515
[rn/touchable-opacity
1616
{:accessibility-label :pinned-banner

src/quo/components/blur/view.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
(ns quo.components.blur.view
2-
(:require [quo.foundations.colors :as colors]
3-
[quo.theme]
2+
(:require [quo.context]
3+
[quo.foundations.colors :as colors]
44
[react-native.blur :as blur]
55
[react-native.core :as rn]
66
[react-native.platform :as platform]))
77

88
(defn- view-android
99
([props] (view-android props nil))
1010
([{:keys [style]} child]
11-
(let [theme (quo.theme/use-theme)]
11+
(let [theme (quo.context/use-theme)]
1212
[rn/view
1313
{:style [style
1414
{:pointer-events :box-none

src/quo/components/browser/browser_input/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
[clojure.string :as string]
44
[quo.components.browser.browser-input.style :as style]
55
[quo.components.icon :as icon]
6+
[quo.context :as quo.context]
67
[quo.foundations.colors :as colors]
7-
[quo.theme :as quo.theme]
88
[react-native.core :as rn]
99
[react-native.platform :as platform]))
1010

@@ -77,7 +77,7 @@
7777
(reset! ref r)
7878
(when get-ref (get-ref r)))
7979
[get-ref])
80-
theme (quo.theme/use-theme)
80+
theme (quo.context/use-theme)
8181
[state set-state] (rn/use-state :default)
8282
[value set-value] (rn/use-state default-value)
8383
on-clear (rn/use-callback

0 commit comments

Comments
 (0)