Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ad944c

Browse files
committedApr 23, 2023
Add preview screen
1 parent ece3920 commit 6ad944c

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
(ns status-im2.contexts.quo-preview.inputs.recovery-phrase-input
2+
(:require [quo2.core :as quo]
3+
[quo2.foundations.colors :as colors]
4+
[react-native.core :as rn]
5+
[reagent.core :as reagent]
6+
[status-im2.contexts.quo-preview.preview :as preview]))
7+
8+
(def descriptor
9+
[{:label "Text"
10+
:key :text
11+
:type :text}
12+
{:label "Placeholder"
13+
:key :placeholder
14+
:type :text}
15+
{:label "Blur"
16+
:key :blur?
17+
:type :boolean}
18+
{:label "Mark errors"
19+
:key :mark-errors?
20+
:type :boolean}
21+
{:label "Customization color"
22+
:key :customization-color
23+
:type :select
24+
:options (map (fn [[color _]]
25+
{:key color :value (name color)})
26+
colors/customization)}
27+
{:label "Word limit"
28+
:key :word-limit
29+
:type :select
30+
:options [{:key nil :value "No limit"}
31+
{:key 5 :value "5 words"}
32+
{:key 10 :value "10 words"}
33+
{:key 20 :value "20 words"}]}])
34+
35+
(defn cool-preview
36+
[]
37+
(let [state (reagent/atom {:text ""
38+
:placeholder "Type or paste your recovery phrase"
39+
:customization-color :blue
40+
:word-limit 20
41+
:mark-errors? true})]
42+
(fn []
43+
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
44+
[rn/view {:style {:padding-bottom 150}}
45+
[rn/view {:style {:flex 1}}
46+
[preview/customizer state descriptor]
47+
[quo/text {:size :paragraph-2}
48+
"(Any word with at least 6 chars is marked as error)"]]
49+
[preview/blur-view
50+
{:style {:align-items :center
51+
:margin-vertical 20
52+
:width "100%"}
53+
:height 200
54+
:show-blur-background? (:blur? @state)}
55+
[rn/view
56+
{:style {:height 150
57+
:width "100%"}}
58+
[quo/recovery-phrase-input
59+
{:mark-errors? (:mark-errors? @state)
60+
:error-pred #(> (count %) 5)
61+
:on-change-text #(swap! state assoc :text %)
62+
:placeholder (:placeholder @state)
63+
:customization-color (:customization-color @state)
64+
:word-limit (:word-limit @state)}
65+
(:text @state)]]]]])))
66+
67+
(defn preview-recovery-phrase-input
68+
[]
69+
[rn/view
70+
{:style {:background-color (colors/theme-colors colors/white colors/neutral-95)
71+
:flex 1}}
72+
[rn/flat-list
73+
{:style {:flex 1}
74+
:keyboardShouldPersistTaps :always
75+
:header [cool-preview]
76+
:key-fn str}]])
77+

Diff for: ‎src/status_im2/contexts/quo_preview/main.cljs

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
[status-im2.contexts.quo-preview.info.info-message :as info-message]
4040
[status-im2.contexts.quo-preview.info.information-box :as information-box]
4141
[status-im2.contexts.quo-preview.inputs.input :as input]
42+
[status-im2.contexts.quo-preview.inputs.recovery-phrase-input :as recovery-phrase-input]
4243
[status-im2.contexts.quo-preview.inputs.profile-input :as profile-input]
4344
[status-im2.contexts.quo-preview.inputs.search-input :as search-input]
4445
[status-im2.contexts.quo-preview.inputs.title-input :as title-input]
@@ -185,6 +186,9 @@
185186
{:name :profile-input
186187
:insets {:top false}
187188
:component profile-input/preview-profile-input}
189+
{:name :recovery-phrase-input
190+
:insets {:top false}
191+
:component recovery-phrase-input/preview-recovery-phrase-input}
188192
{:name :search-input
189193
:insets {:top false}
190194
:component search-input/preview-search-input}

0 commit comments

Comments
 (0)
Please sign in to comment.