Quo2: Token Input followup (#17419)

* Quo2: token input followup
This commit is contained in:
Omar Basem 2023-10-02 09:01:39 +04:00 committed by GitHub
parent f5f1e6302d
commit d8d8a6c7a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 14 deletions

View File

@ -20,11 +20,13 @@
{:width 32 {:width 32
:height 32}) :height 32})
(def text-input (defn text-input
[theme]
(merge typography/heading-1 (merge typography/heading-1
{:font-weight "600" {:font-weight "600"
:margin-left 4 :margin-left 8
:margin-right (if platform/ios? 6 4) :margin-right (if platform/ios? 6 4)
:color (colors/theme-colors colors/neutral-100 colors/white theme)
:padding 0 :padding 0
:text-align :center :text-align :center
:height "100%"})) :height "100%"}))
@ -39,6 +41,6 @@
(def data-container (def data-container
{:padding-top 4 {:padding-top 4
:padding-horizontal 20 :padding-horizontal 20
:height 28
:flex-direction :row :flex-direction :row
:justify-content :space-between}) :justify-content :space-between
:align-items :center})

View File

@ -9,7 +9,9 @@
[react-native.core :as rn] [react-native.core :as rn]
[reagent.core :as reagent] [reagent.core :as reagent]
[quo2.foundations.common :as common] [quo2.foundations.common :as common]
[quo2.components.wallet.token-input.style :as style])) [quo2.components.wallet.token-input.style :as style]
[quo2.components.tags.network-tags.view :as network-tag]
[quo2.components.dividers.divider-line.view :as divider-line]))
(defn calc-value (defn calc-value
[crypto? currency token value conversion] [crypto? currency token value conversion]
@ -23,7 +25,7 @@
value (reagent/atom 0) value (reagent/atom 0)
crypto? (reagent/atom true) crypto? (reagent/atom true)
input-ref (atom nil)] input-ref (atom nil)]
(fn [{:keys [theme token currency conversion]}] (fn [{:keys [theme token currency conversion networks title customization-color]}]
[rn/view {:style (style/main-container width)} [rn/view {:style (style/main-container width)}
[rn/view {:style style/amount-container} [rn/view {:style style/amount-container}
[rn/pressable [rn/pressable
@ -42,22 +44,26 @@
:max-length 12 :max-length 12
:default-value @value :default-value @value
:on-change-text #(reset! value %) :on-change-text #(reset! value %)
:style style/text-input}] :style (style/text-input theme)
:selection-color customization-color}]
[text/text [text/text
{:size :paragraph-2 {:size :paragraph-2
:weight :semi-bold :weight :semi-bold
:style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}} :style {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:margin-right 8
:padding-bottom 2}}
(string/upper-case (clj->js (if @crypto? token currency)))]] (string/upper-case (clj->js (if @crypto? token currency)))]]
[button/button [button/button
{:icon true {:icon true
:icon-only? true
:size 32 :size 32
:on-press #(swap! crypto? not) :on-press #(swap! crypto? not)
:type :outline :type :outline
:accessibility-label :reorder} :accessibility-label :reorder}
:i/reorder]] :i/reorder]]
[rn/view {:style (style/divider width theme)}] [divider-line/view {:container-style {:margin-vertical 8}}]
[rn/view {:style style/data-container} [rn/view {:style style/data-container}
[text/text "[WIP] NETWORK TAG"] [network-tag/view {:networks networks :title title}]
[text/text [text/text
{:size :paragraph-2 {:size :paragraph-2
:weight :medium :weight :medium

View File

@ -1,10 +1,18 @@
(ns status-im2.contexts.quo-preview.wallet.token-input (ns status-im2.contexts.quo-preview.wallet.token-input
(:require (:require
[quo2.core :as quo] [quo2.core :as quo]
[quo2.foundations.resources :as resources]
[react-native.core :as rn] [react-native.core :as rn]
[reagent.core :as reagent] [reagent.core :as reagent]
[status-im2.contexts.quo-preview.preview :as preview])) [status-im2.contexts.quo-preview.preview :as preview]))
(def networks
[{:source (resources/get-network :arbitrum)}
{:source (resources/get-network :optimism)}
{:source (resources/get-network :ethereum)}])
(def title "Max: 200 SNT")
(def descriptor (def descriptor
[{:label "Token:" [{:label "Token:"
:key :token :key :token
@ -25,7 +33,10 @@
[] []
(let [state (reagent/atom {:token :eth (let [state (reagent/atom {:token :eth
:currency :usd :currency :usd
:conversion 0.02})] :conversion 0.02
:networks networks
:title title
:customization-color :blue})]
(fn [] (fn []
[preview/preview-container [preview/preview-container
{:state state {:state state
@ -36,4 +47,5 @@
[rn/view [rn/view
{:style {:flex 1 {:style {:flex 1
:margin-top 50 :margin-top 50
:align-items :center}} [quo/token-input @state]]]]))) :align-items :center}}
[quo/token-input @state]]]])))