-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#17897] Add channel-name component #17903
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/quo/components/text_combinations/channel_name/component_spec.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(ns quo.components.text-combinations.channel-name.component-spec | ||
(:require [quo.components.text-combinations.channel-name.view :as channel-name] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "Channel name" | ||
(h/test "Renders Default" | ||
(h/render [channel-name/view {:channel-name "Test channel"}]) | ||
(h/is-truthy (h/get-by-text "# Test channel"))) | ||
|
||
(h/test "Renders unlocked icon" | ||
(h/render [channel-name/view | ||
{:channel-name "Test channel" | ||
:unlocked? true}]) | ||
(h/is-truthy (h/get-by-label-text :channel-name-unlocked-icon))) | ||
|
||
(h/test "Renders muted icon" | ||
(h/render [channel-name/view | ||
{:channel-name "Test channel" | ||
:muted? true}]) | ||
(h/is-truthy (h/get-by-label-text :channel-name-muted-icon))) | ||
|
||
(h/test "Renders muted and unlocked icon" | ||
(h/render [channel-name/view | ||
{:channel-name "Test channel" | ||
:muted? true | ||
:unlocked? true}]) | ||
(h/is-truthy (h/get-by-label-text :channel-name-unlocked-icon)) | ||
(h/is-truthy (h/get-by-label-text :channel-name-muted-icon)))) |
30 changes: 30 additions & 0 deletions
30
src/quo/components/text_combinations/channel_name/style.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns quo.components.text-combinations.channel-name.style | ||
(:require [quo.foundations.colors :as colors])) | ||
|
||
(def container {:flex-direction :row}) | ||
|
||
(def icons-container | ||
{:flex-direction :row | ||
:padding-top 8 | ||
:padding-bottom 4 | ||
:margin-left 6}) | ||
|
||
(def icon {:width 20 :height 20}) | ||
|
||
(def icons-gap {:width 4}) | ||
|
||
(defn- blur-icon-color | ||
[theme] | ||
(colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-40 theme)) | ||
|
||
(defn unlocked-icon-color | ||
[theme blur?] | ||
(if blur? | ||
(blur-icon-color theme) | ||
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))) | ||
|
||
(defn muted-icon-color | ||
[theme blur?] | ||
(if blur? | ||
(blur-icon-color theme) | ||
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme))) |
40 changes: 40 additions & 0 deletions
40
src/quo/components/text_combinations/channel_name/view.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns quo.components.text-combinations.channel-name.view | ||
(:require [quo.components.icon :as icon] | ||
[quo.components.markdown.text :as text] | ||
[quo.components.text-combinations.channel-name.style :as style] | ||
[quo.theme] | ||
[react-native.core :as rn])) | ||
|
||
(defn icons | ||
[{:keys [theme unlocked? muted? blur?]}] | ||
[rn/view {:style style/icons-container} | ||
(when unlocked? | ||
[rn/view | ||
{:style style/icon | ||
:accessibility-label :channel-name-unlocked-icon} | ||
[icon/icon :i/unlocked | ||
{:color (style/unlocked-icon-color theme blur?) | ||
:size 20}]]) | ||
|
||
(when (and unlocked? muted?) | ||
[rn/view {:style style/icons-gap}]) | ||
|
||
(when muted? | ||
[rn/view | ||
{:style style/icon | ||
:accessibility-label :channel-name-muted-icon} | ||
[icon/icon :i/muted | ||
{:color (style/muted-icon-color theme blur?) | ||
:size 20}]])]) | ||
|
||
(defn- view-internal | ||
[{:keys [unlocked? muted? channel-name] :as props}] | ||
[rn/view {:style style/container} | ||
[text/text | ||
{:size :heading-1 | ||
:weight :semi-bold} | ||
(str "# " channel-name)] | ||
(when (or unlocked? muted?) | ||
[icons props])]) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/status_im2/contexts/quo_preview/text_combinations/channel_name.cljs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(ns status-im2.contexts.quo-preview.text-combinations.channel-name | ||
(:require [quo.core :as quo] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview])) | ||
|
||
|
||
(def descriptor | ||
[{:key :channel-name | ||
:type :text} | ||
{:key :unlocked? | ||
:type :boolean} | ||
{:key :muted? | ||
:type :boolean} | ||
{:key :blur? | ||
:type :boolean}]) | ||
|
||
(defn view | ||
[] | ||
(let [state (reagent/atom {:channel-name "random" | ||
:unlocked? true | ||
:muted? true | ||
:blur? false})] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor | ||
:show-blur-background? true | ||
:blur? (:blur? @state)} | ||
[quo/channel-name @state]]))) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should put the hashtag symbol at the end for RTL languages. We should revisit this in the future when we start adding new languages to the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, interesting.
All the channel names should change if so 🤔 I'm wondering the same.