-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#17288] refactor: migrate previews to new api
- Loading branch information
1 parent
0522120
commit 4892cb0
Showing
5 changed files
with
52 additions
and
104 deletions.
There are no files selected for viewing
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
49 changes: 15 additions & 34 deletions
49
src/status_im2/contexts/quo_preview/numbered_keyboard/numbered_keyboard.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 |
---|---|---|
@@ -1,49 +1,30 @@ | ||
(ns status-im2.contexts.quo-preview.numbered-keyboard.numbered-keyboard | ||
(:require [quo2.core :as quo] | ||
[quo2.foundations.colors :as colors] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview] | ||
[react-native.blur :as blur])) | ||
[status-im2.contexts.quo-preview.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:label "Blur:" | ||
:key :blur? | ||
:type :boolean} | ||
{:label "Disable:" | ||
:key :disabled? | ||
:type :boolean} | ||
{:label "Delete Key:" | ||
:key :delete-key? | ||
:type :boolean} | ||
{:label "Left Action:" | ||
:type :select | ||
[{:key :blur? :type :boolean} | ||
{:key :disabled? :type :boolean} | ||
{:key :delete-key? :type :boolean} | ||
{:type :select | ||
:key :left-action | ||
:options [{:key :dot | ||
:value "Dot"} | ||
{:key :face-id | ||
:value "Face ID"} | ||
{:key :none | ||
:value "None"}]}]) | ||
:options [{:key :dot} | ||
{:key :face-id} | ||
{:key :none}]}]) | ||
|
||
(defn preview-numbered-keyboard | ||
(defn view | ||
[] | ||
(let [state (reagent/atom {:disabled? false | ||
:on-press (fn [item] (js/alert (str item " pressed"))) | ||
:blur? false | ||
:delete-key? true | ||
:left-action :dot}) | ||
blur? (reagent/cursor state [:blur?])] | ||
:left-action :dot})] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor} | ||
(when @blur? | ||
[blur/view | ||
{:style {:position :absolute | ||
:left 0 | ||
:right 0 | ||
:bottom 0 | ||
:height 220 | ||
:background-color colors/neutral-80-opa-70} | ||
:overlay-color :transparent}]) | ||
{:state state | ||
:descriptor descriptor | ||
:blur? (:blur? @state) | ||
:show-blur-background? (:blur? @state) | ||
:blur-height 300} | ||
[quo/numbered-keyboard @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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
(ns status-im2.contexts.quo-preview.password.tips | ||
(:require [quo2.core :as quo] | ||
[quo2.foundations.colors :as colors] | ||
[react-native.core :as rn] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:label "Text" | ||
:key :text | ||
:type :text} | ||
{:label "Completed" | ||
:key :completed? | ||
:type :boolean}]) | ||
[{:key :text :type :text} | ||
{:key :completed? :type :boolean}]) | ||
|
||
(defn preview-tips | ||
(defn view | ||
[] | ||
(let [state (reagent/atom {:text "Lower case" | ||
:completed? false}) | ||
text (reagent/cursor state [:text]) | ||
completed? (reagent/cursor state [:completed?])] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor} | ||
[rn/view {:padding-bottom 150} | ||
[rn/view {:padding 60 :background-color colors/neutral-95} | ||
[quo/tips {:completed? @completed?} @text]]]]))) | ||
{:state state | ||
:descriptor descriptor | ||
:component-container-style {:padding 20 | ||
:background-color colors/neutral-95}} | ||
[quo/tips {:completed? @completed?} @text]]))) |