Skip to content

Commit

Permalink
Use quo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferossgp committed May 27, 2020
1 parent aa45879 commit 4ae0e36
Show file tree
Hide file tree
Showing 71 changed files with 1,330 additions and 2,048 deletions.
16 changes: 10 additions & 6 deletions src/quo/components/animated/pressable.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
(fn [{:keys [background-color border-radius type disabled
on-press on-long-press on-press-start
accessibility-label]
:or {border-radius 0
type :primary}}
:or {border-radius 0
type :primary}}
& children]
(let [{:keys [background foreground]}
(type->animation {:type type
Expand All @@ -76,8 +76,7 @@
[(animated/cond* (animated/eq long-timing 1)
(animated/set long-pressed 1))
(animated/cond* long-pressed
[(animated/set long-pressed 0)
(animated/call* [] handle-long-press)
[(animated/call* [] handle-long-press)
(animated/set state (:undetermined gesture-handler/states))])])}])
[animated/code
{:key (str on-press on-long-press on-press-start)
Expand All @@ -87,11 +86,16 @@
(animated/cond* (animated/and* (animated/eq state (:end gesture-handler/states))
(animated/not* long-pressed))
[(animated/call* [] handle-press)
(animated/set state (:undetermined gesture-handler/states))])])}]
(animated/set state (:undetermined gesture-handler/states))])
(animated/cond* (animated/or* (animated/eq state (:end gesture-handler/states))
(animated/eq state (:cancelled gesture-handler/states))
(animated/eq state (:failed gesture-handler/states)))
(animated/set long-pressed 0))])}]
[gesture-handler/tap-gesture-handler
(merge gesture-handler
{:shouldCancelWhenOutside true
:enabled (not disabled)})
:enabled (boolean (and (or on-press on-long-press on-press-start)
(not disabled)))})
[animated/view {:accessible true
:accessibility-label accessibility-label}
[animated/view {:style (merge absolute-fill
Expand Down
65 changes: 40 additions & 25 deletions src/quo/components/list/item.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
:small 52
64))

(defn size->single-title-size [size]
(case size
:small :base
:large))

(defn container [{:keys [size]} & children]
(into [rn/view {:style (merge (:tiny spacing/padding-horizontal)
{:min-height (size->container-size size)
Expand Down Expand Up @@ -77,28 +82,32 @@
:background-color icon-bg-color}}
[icons/icon icon {:color icon-color}]])])))

(defn title-column [{:keys [title text-color subtitle subtitle-max-lines]}]
(defn title-column
[{:keys [title text-color subtitle subtitle-max-lines
title-accessibility-label size]}]
[rn/view {:style (merge (:tiny spacing/padding-horizontal)
{:justify-content :center})}
(cond

(and title subtitle)
[:<>
[text/text {:weight :medium
:style {:color text-color}
:ellipsize-mode :tail
:number-of-lines 1}
[text/text {:weight :medium
:style {:color text-color}
:accessibility-label title-accessibility-label
:ellipsize-mode :tail
:number-of-lines 1}
title]
[text/text {:weight :regular
:color :secondary
:ellipsize-mode :tail
:number-of-lines subtitle-max-lines}
subtitle]]

title [text/text {:number-of-lines 1
:style {:color text-color}
:ellipsize-mode :tail
:size :large}
title [text/text {:number-of-lines 1
:style {:color text-color}
:title-accessibility-label title-accessibility-label
:ellipsize-mode :tail
:size (size->single-title-size size)}
title])])

(defn left-side [props]
Expand All @@ -115,14 +124,15 @@
(case accessory
:radio [radio/radio active]
:checkbox [checkbox/checkbox {:checked? active}]
;; FIXME(Ferossgp): remove background active on switch type
:switch [rn/switch {:value active
:track-color #js {:true (:interactive-01 @colors/theme)
:false nil}
:on-value-change on-press}]
:text [text/text {:color :secondary
:number-of-lines 1}
accessory-text]
nil)]
accessory)]
(when (and chevron platform/ios?)
[rn/view {:style {:padding-right (:tiny spacing/spacing)}}
[icons/icon :main-icons/next {:container-style {:opacity 0.4
Expand All @@ -131,31 +141,36 @@
:resize-mode :center
:color (:icon-02 @colors/theme)}]])])

;; FIXME(Ferossgp): Inspect error, should we have it here?
(defn list-item
[{:keys [theme accessory disabled subtitle-max-lines icon title
subtitle active on-press on-long-press chevron size
accessory-text]
accessory-text accessibility-label title-accessibility-label]
:or {subtitle-max-lines 1
theme :main}}]
(let [theme (if disabled :disabled theme)
{:keys [icon-color text-color icon-bg-color
active-background passive-background]}
(themes theme)]
[rn/view {:background-color (if active active-background passive-background)}
[animated/pressable {:type :list-item
:disabled disabled
:background-color active-background
:on-press on-press
:on-long-press on-long-press}
[rn/view {:background-color (if (and (= accessory :radio) active)
active-background
passive-background)}
[animated/pressable {:type :list-item
:disabled disabled
:background-color active-background
:accessibility-label accessibility-label
:on-press on-press
:on-long-press on-long-press}
[container {:size size}
[left-side {:icon-color icon-color
:text-color text-color
:icon-bg-color icon-bg-color
:icon icon
:title title
:size size
:subtitle subtitle
:subtitle-max-lines subtitle-max-lines}]
[left-side {:icon-color icon-color
:text-color text-color
:icon-bg-color icon-bg-color
:title-accessibility-label title-accessibility-label
:icon icon
:title title
:size size
:subtitle subtitle
:subtitle-max-lines subtitle-max-lines}]
[right-side {:chevron chevron
:active active
:on-press on-press
Expand Down
13 changes: 7 additions & 6 deletions src/status_im/network/ui/edit_network/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[status-im.ui.components.list.views :as list]
[status-im.ui.components.react :as react]
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.button :as button]
[quo.core :as quo]
[status-im.ui.components.text-input.view :as text-input]
[status-im.ui.components.topbar :as topbar])
(:require-macros [status-im.utils.views :as views]))
Expand Down Expand Up @@ -60,8 +60,9 @@
:on-change-text #(re-frame/dispatch [::network/input-changed :network-id %])}])]]
[react/view styles/bottom-container
[react/view components.styles/flex]
[button/button
{:type :next
:label :t/save
:disabled? (not is-valid?)
:on-press #(re-frame/dispatch [::network/save-network-pressed])}]]]])))
[quo/button
{:after :main-icons/next
:type :secondary
:disabled (not is-valid?)
:on-press #(re-frame/dispatch [::network/save-network-pressed])}
(i18n/label :t/save)]]]])))
9 changes: 3 additions & 6 deletions src/status_im/network/ui/network_details/views.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns status-im.network.ui.network-details.views
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.ui.components.button :as button]
[quo.core :as quo]
[status-im.network.core :as network]
[status-im.network.ui.styles :as st]
[status-im.network.ui.views :as network-settings]
Expand Down Expand Up @@ -40,8 +40,5 @@
(when custom?
[react/view st/bottom-container
[react/view components.styles/flex
[button/button {:label :t/delete
:style st/delete-button
;; TODO: Inspect style of label
:label-style st/delete-button-text
:on-press #(re-frame/dispatch [::network/delete-network-pressed id])}]]])]])))
[quo/button {:on-press #(re-frame/dispatch [::network/delete-network-pressed id])}
(i18n/label :t/delete)]]])]])))
76 changes: 0 additions & 76 deletions src/status_im/ui/components/button.cljs

This file was deleted.

4 changes: 2 additions & 2 deletions src/status_im/ui/components/list/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[status-im.ui.components.checkbox.view :as checkbox]
[status-im.ui.components.colors :as colors]
[status-im.ui.components.icons.vector-icons :as vector-icons]
[status-im.ui.components.list-item.views :as list-item]
[quo.core :as quo]
[status-im.ui.components.list.styles :as styles]
[status-im.ui.components.radio :as radio]
[status-im.ui.components.react :as react]
Expand Down Expand Up @@ -207,7 +207,7 @@
`list-item/list-item` config map and `companent`."
[item _]
(cond
(map? item) [list-item/list-item item]
(map? item) [quo/list-item item]
(vector? item) item
(nil? item) nil
:else [item]))
Expand Down
Loading

0 comments on commit 4ae0e36

Please sign in to comment.