From 0ad8cc8e09e1b7641ca63b86699eaaf6aba8744c Mon Sep 17 00:00:00 2001 From: Alex Yeusiukou Date: Tue, 16 Feb 2016 20:22:59 +0300 Subject: [PATCH] Improved sidebar behaviour, updated styles --- src/app/components/chat/chat.html | 4 ++-- src/app/components/main/main.directive.js | 6 +++--- src/app/components/main/main.html | 6 +++--- src/app/components/sidebar/sidebar.css | 7 +++++++ src/app/components/sidebar/sidebar.directive.js | 7 +------ src/app/components/sidebar/sidebar.html | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 src/app/components/sidebar/sidebar.css diff --git a/src/app/components/chat/chat.html b/src/app/components/chat/chat.html index facc8db..da0c078 100644 --- a/src/app/components/chat/chat.html +++ b/src/app/components/chat/chat.html @@ -1,7 +1,7 @@
- +
@@ -17,7 +17,7 @@
-
+ diff --git a/src/app/components/main/main.directive.js b/src/app/components/main/main.directive.js index 0efc680..fe93982 100644 --- a/src/app/components/main/main.directive.js +++ b/src/app/components/main/main.directive.js @@ -15,13 +15,13 @@ return directive; - function MainController($scope, $mdMedia) { + function MainController($scope, $mdMedia, $mdSidenav) { var main = this; - main.showSidebar = $mdMedia("gt-md"); + $scope.$mdMedia = $mdMedia; main.toggleSidebar = toggleSidebar; function toggleSidebar(){ - main.showSidebar = !main.showSidebar; + $mdSidenav('sidebar').toggle(); } main.user = { diff --git a/src/app/components/main/main.html b/src/app/components/main/main.html index 3ed5176..66f0176 100644 --- a/src/app/components/main/main.html +++ b/src/app/components/main/main.html @@ -1,7 +1,7 @@ -
+
@@ -23,6 +23,6 @@
- - + +
\ No newline at end of file diff --git a/src/app/components/sidebar/sidebar.css b/src/app/components/sidebar/sidebar.css new file mode 100644 index 0000000..18fbed2 --- /dev/null +++ b/src/app/components/sidebar/sidebar.css @@ -0,0 +1,7 @@ +md-sidenav, +md-sidenav.md-locked-open, +md-sidenav.md-closed.md-locked-open-add-active { + min-width: 0px !important; + width: auto !important; + max-width: none !important; +} diff --git a/src/app/components/sidebar/sidebar.directive.js b/src/app/components/sidebar/sidebar.directive.js index fc64916..6f44474 100644 --- a/src/app/components/sidebar/sidebar.directive.js +++ b/src/app/components/sidebar/sidebar.directive.js @@ -20,7 +20,7 @@ return directive; /** @ngInject */ - function SidebarController($rootScope, $scope) { + function SidebarController($rootScope, $scope, $mdSidenav) { var vm = this; vm.users = []; @@ -41,11 +41,6 @@ function openChat(user){ $rootScope.$emit("OPEN_CHAT", user); } - - $scope.$watch("show",function(newValue,oldValue) { - vm.show = newValue; - console.log(newValue); - }); } } diff --git a/src/app/components/sidebar/sidebar.html b/src/app/components/sidebar/sidebar.html index 4f072e7..5215dbc 100644 --- a/src/app/components/sidebar/sidebar.html +++ b/src/app/components/sidebar/sidebar.html @@ -1,4 +1,4 @@ - +