-
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.
feat(wallet)_: Show buy and receive cta on zero balance
Signed-off-by: Mohamed Javid <[email protected]>
- Loading branch information
1 parent
91761a9
commit 3bf84b5
Showing
16 changed files
with
219 additions
and
14 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
(ns quo.components.cards.wallet-card.component-spec | ||
(:require | ||
[quo.components.cards.wallet-card.view :as wallet-card] | ||
[status-im.common.resources :as resources] | ||
[test-helpers.component :as h])) | ||
|
||
(def ^:private base-props | ||
{:image (resources/get-image :buy) | ||
:title "Buy" | ||
:subtitle "Start investing now"}) | ||
|
||
(h/describe "cards: wallet card" | ||
(h/test "Test default render" | ||
(let [event (h/mock-fn)] | ||
(h/render-with-theme-provider [wallet-card/view | ||
(assoc base-props | ||
:on-press | ||
event)]) | ||
(h/is-truthy (h/get-by-label-text :wallet-card)) | ||
(h/is-truthy (h/get-by-text "Buy")) | ||
(h/is-truthy (h/get-by-text "Start investing now")) | ||
(h/is-truthy (h/get-by-label-text :image)) | ||
(h/fire-event :press (h/get-by-label-text :wallet-card)) | ||
(h/was-called event))) | ||
|
||
(h/test "Test render with dismissible prop" | ||
(let [event (h/mock-fn)] | ||
(h/render-with-theme-provider [wallet-card/view | ||
(assoc base-props | ||
:dismissible? true | ||
:on-press-close event)]) | ||
(h/is-truthy (h/get-by-label-text :close-icon)) | ||
(h/fire-event :press (h/get-by-label-text :icon-container)) | ||
(h/was-called event)))) |
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.cards.wallet-card.style | ||
(:require [quo.foundations.colors :as colors] | ||
[quo.foundations.shadows :as shadows])) | ||
|
||
(defn root-container | ||
[theme] | ||
(assoc (shadows/get 2 theme) | ||
:border-radius 16 | ||
:padding-vertical 10 | ||
:padding-horizontal 12 | ||
:width 161 | ||
:background-color (colors/theme-colors colors/white colors/neutral-90 theme))) | ||
|
||
(def top-container | ||
{:flex-direction :row | ||
:height 32 | ||
:justify-content :space-between | ||
:margin-bottom 8}) | ||
|
||
(def image | ||
{:height 32 | ||
:width 32}) | ||
|
||
(defn title | ||
[theme] | ||
{:color (colors/theme-colors colors/neutral-100 colors/white theme)}) | ||
|
||
(defn subtitle | ||
[theme] | ||
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}) |
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,56 @@ | ||
(ns quo.components.cards.wallet-card.view | ||
(:require [quo.components.cards.wallet-card.style :as style] | ||
[quo.components.icon :as icon] | ||
[quo.components.markdown.text :as text] | ||
[quo.theme :as quo.theme] | ||
[react-native.core :as rn] | ||
[react-native.fast-image :as fast-image] | ||
[schema.core :as schema])) | ||
|
||
(def ^:private ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map {:closed true} | ||
[:image :schema.common/image-source] | ||
[:title :string] | ||
[:subtitle :string] | ||
[:dismissible? {:optional true} :boolean] | ||
[:on-press {:optional true} fn?] | ||
[:on-press-close {:optional true} fn?]]]] | ||
:any]) | ||
|
||
(defn- view-internal | ||
[{:keys [image title subtitle dismissible? on-press on-press-close]}] | ||
(let [theme (quo.theme/use-theme)] | ||
[rn/pressable | ||
{:on-press on-press | ||
:accessibility-label :wallet-card} | ||
[rn/view {:style (style/root-container theme)} | ||
[rn/view {:style style/top-container} | ||
[fast-image/fast-image | ||
{:style style/image | ||
:source image | ||
:accessibility-label :image}] | ||
(when dismissible? | ||
[rn/pressable | ||
{:on-press on-press-close | ||
:accessibility-label :icon-container | ||
:hit-slop {:top 5 :bottom 5 :left 5 :right 5}} | ||
[icon/icon :i/close | ||
{:size 12 | ||
:accessibility-label :close-icon}]])] | ||
[text/text | ||
{:style (style/title theme) | ||
:size :paragraph-1 | ||
:weight :semi-bold | ||
:number-of-lines 1} | ||
title] | ||
[text/text | ||
{:style (style/subtitle theme) | ||
:size :paragraph-2 | ||
:weight :regular | ||
:number-of-lines 1} | ||
subtitle]]])) | ||
|
||
(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
(ns status-im.contexts.preview.quo.cards.wallet-card | ||
(:require | ||
[quo.core :as quo] | ||
[reagent.core :as reagent] | ||
[status-im.common.resources :as resources] | ||
[status-im.contexts.preview.quo.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:key :title | ||
:type :text} | ||
{:key :subtitle | ||
:type :text} | ||
{:key :dismissible? | ||
:type :boolean}]) | ||
|
||
(defn view | ||
[] | ||
(let [state (reagent/atom {:image (resources/get-image :buy) | ||
:title "Buy" | ||
:subtitle "Start investing now" | ||
:on-press #(js/alert "Item pressed") | ||
:on-press-close #(js/alert "Close pressed") | ||
:dismissible? false})] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor | ||
:component-container-style {:align-items :center}} | ||
[quo/wallet-card @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
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