-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add menu options; use not-animated renderer Use menu.open() instead of default trigger Add wrap-with-menu; right-click menu for chat list
- Loading branch information
Vitaliy Vlasov
committed
Nov 13, 2018
1 parent
c088e7b
commit 1b6d18b
Showing
9 changed files
with
90 additions
and
23 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
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,10 @@ | ||
(ns status-im.ui.components.popup-menu.styles | ||
(:require [status-im.ui.components.colors :as colors] | ||
[status-im.ui.components.react :as react])) | ||
|
||
(def menu-style | ||
{:border-width 1 | ||
:border-color colors/gray | ||
:border-radius 5 | ||
:background-color colors/gray-lighter}) | ||
|
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,23 @@ | ||
(ns status-im.ui.components.popup-menu.views | ||
(:require [status-im.ui.components.popup-menu.styles :as styles] | ||
[status-im.ui.components.react :as react] | ||
[taoensso.timbre :as log])) | ||
|
||
(defn wrap-with-menu [component items left-click-action right-click-action] | ||
(let [menu-ref (atom nil) | ||
left-click-action (if (= left-click-action :menu) #(.open @menu-ref) | ||
(or left-click-action :none)) | ||
right-click-action (if (= right-click-action :menu) #(.open @menu-ref) | ||
(or right-click-action :none))] | ||
[react/popup-menu {:renderer (:NotAnimatedContextMenu react/popup-menu-renderers) | ||
:ref #(reset! menu-ref %)} | ||
[react/popup-menu-trigger {:disabled true}] | ||
(into [react/popup-menu-options {:custom-styles {:options-wrapper styles/menu-style}}] | ||
(for [i items] | ||
[react/popup-menu-option i])) | ||
[react/touchable-highlight | ||
{:on-press #(let [right-click? (= "right" (.-button (.-nativeEvent %)))] | ||
(log/debug "### wrap-with-menu" right-click?) | ||
(if right-click? (right-click-action) (left-click-action)))} | ||
component]])) | ||
|
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