-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
src/quo2/components/avatars/collection_avatar/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,18 @@ | ||
(ns quo2.components.avatars.collection-avatar.component-spec | ||
(:require [quo2.components.avatars.collection-avatar.view :as collection-avatar] | ||
[status-im2.common.resources :as resources] | ||
[test-helpers.component :as h])) | ||
|
||
(defonce bored-ape (resources/get-mock-image :bored-ape)) | ||
|
||
(h/describe "collection avatar" | ||
(h/describe "Profile picture" | ||
(h/test "Doesn't crash without image" | ||
(h/render | ||
[collection-avatar/view]) | ||
(h/is-truthy (h/get-by-label-text :collection-avatar))) | ||
|
||
(h/test "Renders with image" | ||
(h/render | ||
[collection-avatar/view {:image bored-ape}]) | ||
(h/is-truthy (h/get-by-label-text :collection-avatar))))) |
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,10 @@ | ||
(ns quo2.components.avatars.collection-avatar.style | ||
(:require [quo2.foundations.colors :as colors])) | ||
|
||
(defn collection-avatar | ||
[theme] | ||
{:width 24 | ||
:height 24 | ||
:border-width 1 | ||
:border-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme) | ||
:border-radius 6}) |
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,18 @@ | ||
(ns quo2.components.avatars.collection-avatar.view | ||
(:require [quo2.components.avatars.collection-avatar.style :as style] | ||
[quo2.theme :as quo.theme] | ||
[react-native.fast-image :as fast-image] | ||
)) | ||
|
||
(defn- view-internal | ||
"Opts: | ||
:image - collection image | ||
:theme - keyword -> :light/:dark" | ||
[{:keys [image theme]}] | ||
[fast-image/fast-image | ||
{:accessibility-label :collection-avatar | ||
:source image | ||
:style (style/collection-avatar theme)}]) | ||
|
||
(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
27 changes: 27 additions & 0 deletions
27
src/status_im2/contexts/quo_preview/avatars/collection_avatar.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,27 @@ | ||
(ns status-im2.contexts.quo-preview.avatars.collection-avatar | ||
|
||
(:require [quo2.core :as quo] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview] | ||
[status-im2.common.resources :as resources])) | ||
|
||
(def descriptor | ||
[{:key :image | ||
:type :select | ||
:options [{:key (resources/get-mock-image :bored-ape) | ||
:value "Bored ape"} | ||
{:key (resources/get-mock-image :ring) | ||
:value "Circle"} | ||
]} | ||
]) | ||
|
||
(defn view | ||
[] | ||
(let [state (reagent/atom {:image (resources/get-mock-image :bored-ape) | ||
})] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor | ||
:component-container-style {:align-items :center}} | ||
[quo/collection-avatar @state]]))) |
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