-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 19232-fix-derivation-path-creation
- Loading branch information
Showing
25 changed files
with
585 additions
and
279 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/quo/components/avatars/community_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,9 @@ | ||
(ns quo.components.avatars.community-avatar.component-spec | ||
(:require [quo.components.avatars.community-avatar.view :as community-avatar] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "Avatars: Community Avatar" | ||
(h/test "should render correctly" | ||
(h/render-with-theme-provider | ||
[community-avatar/view {:image "mock-image"}]) | ||
(h/is-truthy (h/get-by-label-text :community-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,12 @@ | ||
(ns quo.components.avatars.community-avatar.style) | ||
|
||
(def ^:private sizes | ||
{:size-32 32 | ||
:size-24 24}) | ||
|
||
(defn image | ||
[size] | ||
(let [size-val (sizes size)] | ||
{:border-radius (/ size-val 2) | ||
:width size-val | ||
:height size-val})) |
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,23 @@ | ||
(ns quo.components.avatars.community-avatar.view | ||
(:require [quo.components.avatars.community-avatar.style :as style] | ||
[react-native.core :as rn] | ||
[schema.core :as schema])) | ||
|
||
(def ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map {:closed true} | ||
[:size {:optional true} [:maybe [:enum :size-32 :size-24]]] | ||
[:image :schema.common/image-source] | ||
[:container-style {:optional true} [:maybe :map]]]]] | ||
:any]) | ||
|
||
(defn- view-internal | ||
[{:keys [size image container-style]}] | ||
[rn/image | ||
{:source image | ||
:accessibility-label :community-avatar | ||
:style (merge (style/image size) container-style)}]) | ||
|
||
(def view (schema/instrument #'view-internal ?schema)) |
14 changes: 14 additions & 0 deletions
14
src/quo/components/avatars/dapp_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,14 @@ | ||
(ns quo.components.avatars.dapp-avatar.component-spec | ||
(:require [quo.components.avatars.dapp-avatar.view :as dapp-avatar] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "Avatars: dApp Avatar" | ||
(h/test "should render correctly without context" | ||
(h/render-with-theme-provider | ||
[dapp-avatar/view {:image "mock-image"}]) | ||
(h/is-truthy (h/get-by-label-text :dapp-avatar))) | ||
|
||
(h/test "should render correctly with context" | ||
(h/render-with-theme-provider | ||
[dapp-avatar/view {:image "mock-image" :network-image "mock-image" :context? true}]) | ||
(h/is-truthy (h/get-by-label-text :dapp-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,23 @@ | ||
(ns quo.components.avatars.dapp-avatar.style) | ||
|
||
(def ^:const size 32) | ||
|
||
(def container | ||
{:height size | ||
:width size}) | ||
|
||
(def hole-view | ||
{:width size | ||
:height size}) | ||
|
||
(def context | ||
{:width 16 | ||
:height 16 | ||
:border-radius 8 | ||
:position :absolute | ||
:right -4 | ||
:bottom -4}) | ||
|
||
(def image | ||
{:width size | ||
:height size}) |
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,42 @@ | ||
(ns quo.components.avatars.dapp-avatar.view | ||
(:require [quo.components.avatars.dapp-avatar.style :as style] | ||
[react-native.core :as rn] | ||
[react-native.hole-view :as hole-view] | ||
[react-native.platform :as platform] | ||
[schema.core :as schema])) | ||
|
||
(def ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map {:closed true} | ||
[:context? {:optional true} [:maybe :boolean]] | ||
[:image :schema.common/image-source] | ||
[:network-image {:optional true} [:maybe :schema.common/image-source]] | ||
[:container-style {:optional true} [:maybe :map]]]]] | ||
:any]) | ||
|
||
(defn- view-internal | ||
[{:keys [context? image network-image container-style]}] | ||
[rn/view | ||
{:style (merge style/container container-style) | ||
:accessibility-label :dapp-avatar} | ||
[hole-view/hole-view | ||
(cond-> {:holes (if context? | ||
[{:x 19 | ||
:y 19 | ||
:width 18 | ||
:height 18 | ||
:borderRadius 9}] | ||
[]) | ||
:style style/hole-view} | ||
platform/android? (assoc :key context?)) | ||
[rn/image | ||
{:source image | ||
:style style/image}]] | ||
(when context? | ||
[rn/image | ||
{:source network-image | ||
:style style/context}])]) | ||
|
||
(def view (schema/instrument #'view-internal ?schema)) |
14 changes: 14 additions & 0 deletions
14
src/quo/components/avatars/token_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,14 @@ | ||
(ns quo.components.avatars.token-avatar.component-spec | ||
(:require [quo.components.avatars.token-avatar.view :as token-avatar] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "Avatars: Token Avatar" | ||
(h/test "should render correctly without context" | ||
(h/render-with-theme-provider | ||
[token-avatar/view {:image "mock-image"}]) | ||
(h/is-truthy (h/get-by-label-text :token-avatar))) | ||
|
||
(h/test "should render correctly with context" | ||
(h/render-with-theme-provider | ||
[token-avatar/view {:image "mock-image" :network-image "mock-image" :context? true}]) | ||
(h/is-truthy (h/get-by-label-text :token-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,25 @@ | ||
(ns quo.components.avatars.token-avatar.style) | ||
|
||
(def ^:const size 32) | ||
|
||
(def container | ||
{:height size | ||
:width size}) | ||
|
||
(def hole-view | ||
{:width size | ||
:height size}) | ||
|
||
(def context | ||
{:width 16 | ||
:height 16 | ||
:border-radius 8 | ||
:position :absolute | ||
:right -4 | ||
:bottom -4}) | ||
|
||
(defn image | ||
[type] | ||
{:width size | ||
:border-radius (if (= type :collectible) 8 0) | ||
:height size}) |
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,43 @@ | ||
(ns quo.components.avatars.token-avatar.view | ||
(:require [quo.components.avatars.token-avatar.style :as style] | ||
[react-native.core :as rn] | ||
[react-native.hole-view :as hole-view] | ||
[react-native.platform :as platform] | ||
[schema.core :as schema])) | ||
|
||
(def ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map {:closed true} | ||
[:type {:optional true} [:enum :asset :collectible]] | ||
[:context? {:optional true} [:maybe :boolean]] | ||
[:image :schema.common/image-source] | ||
[:network-image {:optional true} [:maybe :schema.common/image-source]] | ||
[:container-style {:optional true} [:maybe :map]]]]] | ||
:any]) | ||
|
||
(defn- view-internal | ||
[{:keys [type context? image network-image container-style]}] | ||
[rn/view | ||
{:style (merge style/container container-style) | ||
:accessibility-label :token-avatar} | ||
[hole-view/hole-view | ||
(cond-> {:holes (if context? | ||
[{:x 19 | ||
:y 19 | ||
:width 18 | ||
:height 18 | ||
:borderRadius 9}] | ||
[]) | ||
:style style/hole-view} | ||
platform/android? (assoc :key context?)) | ||
[rn/image | ||
{:source image | ||
:style (style/image type)}]] | ||
(when context? | ||
[rn/image | ||
{:source network-image | ||
:style style/context}])]) | ||
|
||
(def view (schema/instrument #'view-internal ?schema)) |
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
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
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
24 changes: 24 additions & 0 deletions
24
src/status_im/contexts/preview/quo/avatars/community_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,24 @@ | ||
(ns status-im.contexts.preview.quo.avatars.community-avatar | ||
(:require | ||
[quo.core :as quo] | ||
[react-native.core :as rn] | ||
[status-im.common.resources :as resources] | ||
[status-im.contexts.preview.quo.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:type :select | ||
:key :size | ||
:options [{:key :size-32} | ||
{:key :size-24}]}]) | ||
|
||
(defn view | ||
[] | ||
(let [[state set-state] (rn/use-state {:size :size-32})] | ||
[preview/preview-container | ||
{:state state | ||
:set-state set-state | ||
:descriptor descriptor} | ||
[quo/community-avatar | ||
(assoc state | ||
:image | ||
(resources/get-mock-image :community-logo))]])) |
Oops, something went wrong.