Wallet: Create Account UI (2) (#17468)

* Wallet: create account UI (2)
This commit is contained in:
Omar Basem 2023-10-04 14:17:55 +04:00 committed by GitHub
parent df2b5147cd
commit 191f5de6f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 57 additions and 37 deletions

View File

@ -18,10 +18,11 @@
- `blur?` Boolean to enable blur background support.}" - `blur?` Boolean to enable blur background support.}"
[{:keys [default-selected]}] [{:keys [default-selected]}]
(let [selected (reagent/atom default-selected)] (let [selected (reagent/atom default-selected)]
(fn [{:keys [blur? on-change feng-shui?]}] (fn [{:keys [blur? on-change feng-shui? container-style]}]
[rn/scroll-view [rn/scroll-view
{:horizontal true {:horizontal true
:shows-horizontal-scroll-indicator false} :shows-horizontal-scroll-indicator false
:content-container-style container-style}
(doall (map (fn [color] (doall (map (fn [color]
[color/view [color/view
{:selected? (= color @selected) {:selected? (= color @selected)

View File

@ -39,7 +39,7 @@
[rn/text-input [rn/text-input
{:style {:style
(text/text-style (text/text-style
{:size :heading-2 {:size :heading-1
:weight :semi-bold :weight :semi-bold
:style (style/title-text theme)}) :style (style/title-text theme)})
:default-value default-value :default-value default-value

View File

@ -13,9 +13,10 @@
{:flex-direction :row {:flex-direction :row
:align-items (if (or tag description) :flex-start :center)}) :align-items (if (or tag description) :flex-start :center)})
(def sub-container (defn sub-container
[align-action]
{:flex-direction :row {:flex-direction :row
:align-items :center}) :align-items (or align-action :center)})
(def left-container (def left-container
{:margin-left 12 {:margin-left 12

View File

@ -28,7 +28,7 @@
[{:keys [description-props blur? theme]}] [{:keys [description-props blur? theme]}]
(let [{:keys [text icon]} description-props] (let [{:keys [text icon]} description-props]
[rn/view [rn/view
{:style style/sub-container} {:style (style/sub-container :center)}
[text/text [text/text
{:size :paragraph-2 {:size :paragraph-2
:style (style/color blur? theme)} :style (style/color blur? theme)}
@ -93,15 +93,15 @@
(case action (case action
:arrow [icon/icon :i/chevron-right (style/color blur? theme)] :arrow [icon/icon :i/chevron-right (style/color blur? theme)]
:button [button/button :button [button/button
(merge action-props
{:type :outline {:type :outline
:size 24 :size 24})
:on-press (:on-press action-props)}
(:button-text action-props)] (:button-text action-props)]
:selector [selectors/toggle action-props] :selector [selectors/toggle action-props]
nil)]) nil)])
(defn- internal-view (defn- internal-view
[{:keys [title on-press accessibility-label] :as props}] [{:keys [title on-press action-props accessibility-label] :as props}]
[rn/pressable [rn/pressable
{:style (style/container props) {:style (style/container props)
:on-press on-press :on-press on-press
@ -112,7 +112,7 @@
[text/text {:weight :medium} title] [text/text {:weight :medium} title]
[description-component props] [description-component props]
[tag-component props]]] [tag-component props]]]
[rn/view {:style style/sub-container} [rn/view {:style (style/sub-container (:alignment action-props))}
[label-component props] [label-component props]
[action-component props]]]) [action-component props]]])

View File

@ -1,7 +1,10 @@
(ns status-im2.contexts.wallet.common.temp (ns status-im2.contexts.wallet.common.temp
(:require [quo2.core :as quo] (:require
[clojure.string :as string]
[quo2.core :as quo]
[quo2.foundations.resources :as quo.resources] [quo2.foundations.resources :as quo.resources]
[react-native.core :as rn] [react-native.core :as rn]
[status-im2.constants :as constants]
[status-im2.contexts.wallet.common.utils :as utils] [status-im2.contexts.wallet.common.utils :as utils]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf])) [utils.re-frame :as rf]))
@ -79,8 +82,23 @@
(defn create-account-state (defn create-account-state
[name] [name]
[{:title (keypair-string name) [{:title (keypair-string name)
:button-props {:title (i18n/label :t/edit)} :image :avatar
:left-icon :i/placeholder} :image-props {:full-name "A Y"
:size :xxs
:customization-color :blue}
:action :button
:action-props {:on-press #(js/alert "Button pressed!")
:button-text (i18n/label :t/edit)
:alignment :flex-start}
:description :text
:description-props {:text (i18n/label :t/on-device)}}
{:title (i18n/label :t/derivation-path) {:title (i18n/label :t/derivation-path)
:button-props {:title (i18n/label :t/edit)} :image :icon
:left-icon :i/derivated-path}]) :image-props :i/derivated-path
:action :button
:action-props {:on-press #(js/alert "Button pressed!")
:button-text (i18n/label :t/edit)
:icon-left :i/placeholder
:alignment :flex-start}
:description :text
:description-props {:text (string/replace constants/path-default-wallet #"/" " / ")}}])

View File

@ -24,20 +24,17 @@
:padding-bottom 16}) :padding-bottom 16})
(def color-picker-container (def color-picker-container
{:padding-vertical 12 {:padding-vertical 12})
:padding-horizontal 20})
(defn color-label (defn color-label
[theme] [theme]
{:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme) {:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:padding-bottom 4}) :padding-bottom 4
:padding-horizontal 20})
(defn divider-line (def divider-line
[theme] {:margin-top 12
{:border-color (colors/theme-colors colors/neutral-10 colors/neutral-90 theme) :margin-bottom 8})
:padding-top 12
:padding-bottom 8
:border-bottom-width 1})
(defn slide-button-container (defn slide-button-container
[bottom] [bottom]

View File

@ -57,6 +57,7 @@
:disabled? false :disabled? false
:default-value "Account 2" :default-value "Account 2"
:container-style style/title-input-container}] :container-style style/title-input-container}]
[quo/divider-line]
[rn/view [rn/view
{:style style/color-picker-container} {:style style/color-picker-container}
[quo/text [quo/text
@ -66,14 +67,16 @@
(i18n/label :t/colour)] (i18n/label :t/colour)]
[quo/color-picker [quo/color-picker
{:default-selected @account-color {:default-selected @account-color
:on-change #(reset! account-color %)}]] :on-change #(reset! account-color %)
[rn/view {:style (style/divider-line theme)}] :container-style {:padding-horizontal 12
:padding-vertical 12}}]]
[quo/divider-line]
[quo/category [quo/category
{:list-type :settings {:list-type :settings
:label (i18n/label :t/origin) :label (i18n/label :t/origin)
:data (temp/create-account-state display-name)}] :data (temp/create-account-state display-name)}]
[quo/slide-button [quo/slide-button
{:track-text (i18n/label :t/slide-create) {:track-text (i18n/label :t/slide-to-sign)
:track-icon :face-id :track-icon :face-id
:customization-color @account-color :customization-color @account-color
:on-complete (fn [] :on-complete (fn []

View File

@ -2300,7 +2300,7 @@
"add-address-description": "Watch a public address or ENS name", "add-address-description": "Watch a public address or ENS name",
"colour": "Colour", "colour": "Colour",
"origin": "Origin", "origin": "Origin",
"slide-create": "Slide to create account", "slide-to-sign": "Slide to sign",
"user-keypair": "{{name}}'s Keypair", "user-keypair": "{{name}}'s Keypair",
"trip-accounts": "Trip accounts", "trip-accounts": "Trip accounts",
"destroy": "Destroy", "destroy": "Destroy",