Former-commit-id: ac4548f63b
This commit is contained in:
Roman Volosovskyi 2016-05-16 13:40:43 +03:00
parent 4d9b81edf5
commit b893cce7bb
2 changed files with 26 additions and 24 deletions

View File

@ -11,6 +11,7 @@
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
[syng-im.components.action-button :refer [action-button
action-button-item]]
[syng-im.components.drawer :refer [drawer-view open-drawer]]
[syng-im.components.styles :refer [color-blue]]
[syng-im.components.toolbar :refer [toolbar]]
[syng-im.components.icons.ionicons :refer [icon]]
@ -20,7 +21,7 @@
(defn chats-list-toolbar []
[toolbar {:nav-action {:image {:source {:uri :icon_hamburger}
:style st/hamburger-icon}
:handler (fn [])}
:handler open-drawer}
:title "Chats"
:action {:image {:source {:uri :icon_search}
:style st/search-icon}
@ -29,22 +30,23 @@
(defn chats-list []
(let [chats (subscribe [:get :chats])]
(fn []
[view st/chats-container
[chats-list-toolbar]
[list-view {:dataSource (to-datasource (vals @chats))
:renderRow (fn [row _ _]
(list-item [chat-list-item row]))
:style st/list-container}]
[action-button {:buttonColor color-blue}
[action-button-item
{:title "New Chat"
:buttonColor :#9b59b6
:onPress #(dispatch [:navigate-to :contact-list])}
[icon {:name :android-create
:style st/create-icon}]]
[action-button-item
{:title "New Group Chat"
:buttonColor :#1abc9c
:onPress #(dispatch [:show-group-new])}
[icon {:name :person-stalker
:style st/person-stalker-icon}]]]])))
[drawer-view
[view st/chats-container
[chats-list-toolbar]
[list-view {:dataSource (to-datasource (vals @chats))
:renderRow (fn [row _ _]
(list-item [chat-list-item row]))
:style st/list-container}]
[action-button {:buttonColor color-blue}
[action-button-item
{:title "New Chat"
:buttonColor :#9b59b6
:onPress #(dispatch [:navigate-to :contact-list])}
[icon {:name :android-create
:style st/create-icon}]]
[action-button-item
{:title "New Group Chat"
:buttonColor :#1abc9c
:onPress #(dispatch [:show-group-new])}
[icon {:name :person-stalker
:style st/person-stalker-icon}]]]]])))

View File

@ -35,9 +35,9 @@
[text {:style st/menu-item-text}
name]])
(defn drawer-menu [navigator]
(defn drawer-menu []
(let [username (subscribe [:get :username])]
(fn [navigator]
(fn []
[view st/drawer-menu
[view st/user-photo-container
[user-photo {}]]
@ -72,10 +72,10 @@
[text {:style st/switch-users-text}
"Switch users"]]]])))
(defn drawer-view [{:keys [navigator]} items]
(defn drawer-view [items]
[drawer-layout-android {:drawerWidth 260
:drawerPosition js/React.DrawerLayoutAndroid.positions.Left
:render-navigation-view #(r/as-element [drawer-menu navigator])
:render-navigation-view #(r/as-element [drawer-menu])
:ref (fn [drawer]
(reset! drawer-atom drawer))}
items])