-
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
2df7a7c
commit 54f9fda
Showing
7 changed files
with
104 additions
and
193 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
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
58 changes: 26 additions & 32 deletions
58
src/status_im2/contexts/quo_preview/tabs/segmented_tab.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,50 +1,44 @@ | ||
(ns status-im2.contexts.quo-preview.tabs.segmented-tab | ||
(:require | ||
[quo.components.tabs.segmented-tab :as quo] | ||
[quo.theme :as theme] | ||
[quo.core :as quo] | ||
[react-native.core :as rn] | ||
[reagent.core :as reagent] | ||
[status-im2.contexts.quo-preview.preview :as preview])) | ||
|
||
(def descriptor | ||
[{:label "Size:" | ||
:key :size | ||
[{:key :size | ||
:type :select | ||
:options [{:key 28 | ||
:value "28"} | ||
{:key 20 | ||
:value "20"}]} | ||
{:label "Blur?" | ||
:key :blur? | ||
:type :boolean}]) | ||
{:key :blur? | ||
:type :boolean}]) | ||
|
||
(defn preview-segmented | ||
(defn view | ||
[] | ||
(let [state (reagent/atom {:size 32 | ||
:blur? false})] | ||
(fn [] | ||
[preview/preview-container | ||
{:state state | ||
:descriptor descriptor} | ||
[rn/view {:padding-bottom 150} | ||
[preview/blur-view | ||
{:show-blur-background? (:blur? @state) | ||
:height 200 | ||
:style {:width "100%"} | ||
:blur-view-props {:blur-type (theme/get-theme)}} | ||
[:<> | ||
[quo/segmented-control | ||
(merge @state | ||
{:default-active 1 | ||
:data [{:id 1 :label "Tab 1"} | ||
{:id 2 :label "Tab 2"} | ||
{:id 3 :label "Tab 3"} | ||
{:id 4 :label "Tab 4"}] | ||
:on-change #(println "Active tab" %)})] | ||
[rn/view {:style {:padding-top 24}} | ||
[quo/segmented-control | ||
(merge @state | ||
{:default-active 1 | ||
:data [{:id 1 :label "Tab 1"} | ||
{:id 2 :label "Tab 2"}] | ||
:on-change #(println "Active tab" %)})]]]]]]))) | ||
{:state state | ||
:descriptor descriptor | ||
:blur? (:blur? @state) | ||
:show-blur-background? true | ||
:component-container-style {:padding-vertical 60}} | ||
[:<> | ||
[quo/segmented-control | ||
(merge @state | ||
{:default-active 1 | ||
:data [{:id 1 :label "Tab 1"} | ||
{:id 2 :label "Tab 2"} | ||
{:id 3 :label "Tab 3"} | ||
{:id 4 :label "Tab 4"}] | ||
:on-change #(println "Active tab" %)})] | ||
[rn/view {:style {:padding-top 24}} | ||
[quo/segmented-control | ||
(merge @state | ||
{:default-active 1 | ||
:data [{:id 1 :label "Tab 1"} | ||
{:id 2 :label "Tab 2"}] | ||
:on-change #(println "Active tab" %)})]]]]))) |
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
Oops, something went wrong.