-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
32cfd21
commit f631e1f
Showing
27 changed files
with
309 additions
and
76 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
31 changes: 31 additions & 0 deletions
31
src/quo/components/buttons/logout_button/component_spec.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(ns quo.components.buttons.logout-button.component-spec | ||
(:require | ||
[quo.components.buttons.logout-button.view :as logout-button] | ||
[test-helpers.component :as h])) | ||
|
||
(h/describe "button tests" | ||
(h/test "default render of logout button component" | ||
(h/render [logout-button/view]) | ||
(h/is-truthy (h/get-by-label-text :log-out-button))) | ||
|
||
(h/test "button on-press works" | ||
(let [event (h/mock-fn)] | ||
(h/render [logout-button/view | ||
{:on-press event}]) | ||
(h/fire-event :press (h/get-by-label-text :log-out-button)) | ||
(h/was-called event))) | ||
|
||
(h/test "button on-press disabled when disabled" | ||
(let [event (h/mock-fn)] | ||
(h/render [logout-button/view | ||
{:on-press event | ||
:disabled? true}]) | ||
(h/fire-event :press (h/get-by-label-text :log-out-button)) | ||
(h/was-not-called event))) | ||
|
||
(h/test "button on-long-press works" | ||
(let [event (h/mock-fn)] | ||
(h/render [logout-button/view | ||
{:on-long-press event}]) | ||
(h/fire-event :long-press (h/get-by-label-text :log-out-button)) | ||
(h/was-called event)))) |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(ns quo.components.buttons.logout-button.style | ||
(:require | ||
[quo.foundations.colors :as colors])) | ||
|
||
(defn main | ||
[{:keys [pressed? disabled?]}] | ||
{:background-color (if pressed? colors/danger-50-opa-40 colors/danger-50-opa-30) | ||
:border-radius 12 | ||
:height 40 | ||
:gap 4 | ||
:padding-right 3 | ||
:flex-direction :row | ||
:justify-content :center | ||
:align-items :center | ||
:opacity (when disabled? 0.2)}) |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns quo.components.buttons.logout-button.view | ||
(:require | ||
[quo.components.buttons.logout-button.style :as style] | ||
[quo.components.icon :as icon] | ||
[quo.components.markdown.text :as text] | ||
[quo.foundations.colors :as colors] | ||
[quo.theme :as quo.theme] | ||
[react-native.core :as rn] | ||
[reagent.core :as reagent] | ||
[utils.i18n :as i18n])) | ||
|
||
(defn- view-internal | ||
[_] | ||
(let [pressed? (reagent/atom false) | ||
on-press-in #(reset! pressed? true) | ||
on-press-out #(reset! pressed? nil)] | ||
(fn | ||
[{:keys [on-press on-long-press disabled? theme container-style]}] | ||
[rn/pressable | ||
{:accessibility-label :log-out-button | ||
:on-press on-press | ||
:on-press-in on-press-in | ||
:on-press-out on-press-out | ||
:on-long-press on-long-press | ||
:disabled disabled? | ||
:style (merge (style/main {:pressed? @pressed? | ||
:theme theme | ||
:disabled? disabled?}) | ||
container-style)} | ||
[icon/icon :i/log-out {:color (if pressed? colors/white-opa-40 colors/white-opa-70)}] | ||
[text/text {:weight :medium :size :paragraph-1} | ||
(i18n/label :t/logout)]]))) | ||
|
||
(def view (quo.theme/with-theme view-internal)) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ | |
|
||
(def emoji-hash | ||
{:margin-top 8 | ||
:letter-spacing 0.5 | ||
:letter-spacing 2 | ||
:font-size 13 | ||
:line-height 20.5}) |
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
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.