Skip to content

Commit

Permalink
Improved sidebar behaviour, updated styles
Browse files Browse the repository at this point in the history
  • Loading branch information
yeusiukou committed Feb 16, 2016
1 parent e3823a6 commit 0ad8cc8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/app/components/chat/chat.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div layout="row" flex>
<md-content style="background-color: #DCDCDC;" id="chat-content">
<md-list>
<md-list-item ng-repeat="message in chat.messages" layout-margin>
<md-list-item ng-repeat="message in chat.messages" style="margin-top: 8px; margin-bottom: 8px;">
<div flex-order="{{message.user ? 2 : 0}}" layout="column" layout-align="center center" class="md-caption">
<img layout="row" style="margin: 0;" ng-src="{{message.avatar}}" class="md-avatar"></img>
<div style="text-align: center; color: #5F5F5F;">
Expand All @@ -17,7 +17,7 @@
</md-list>
</md-content>
</div>
<form layout="row" style="padding: 20px;" ng-submit="chat.sendMessage()">
<form layout="row" style="padding: 20px;" ng-submit="chat.sendMessage()" autocomplete="off">
<md-input-container flex layout-align="center" layout-fill>
<label>What do you want to say?</label>
<input type="text" ng-model="chat.myMessage"></input>
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/main/main.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/main/main.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Container #1 (see wireframe) -->
<md-toolbar layout="row">

<div layout="row" layout-align="left center">
<div layout="row" layout-align="left center" ng-show="!$mdMedia('gt-xs')">
<md-button class="md-icon-button" ng-click="main.toggleSidebar();">

<md-icon md-font-icon="material-icons">
Expand All @@ -23,6 +23,6 @@
<!-- Container #2 -->
<div flex layout="row">
<!-- Sidebar -->
<by-chat layout="column" flex></by-chat>
<by-sidebar layout="column" show="main.showSidebar"><by-sidebar/>
<by-chat layout="column" flex></by-chat>
<by-sidebar layout="column"><by-sidebar/>
</div>
7 changes: 7 additions & 0 deletions src/app/components/sidebar/sidebar.css
Original file line number Diff line number Diff line change
@@ -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;
}
7 changes: 1 addition & 6 deletions src/app/components/sidebar/sidebar.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
return directive;

/** @ngInject */
function SidebarController($rootScope, $scope) {
function SidebarController($rootScope, $scope, $mdSidenav) {
var vm = this;

vm.users = [];
Expand All @@ -41,11 +41,6 @@
function openChat(user){
$rootScope.$emit("OPEN_CHAT", user);
}

$scope.$watch("show",function(newValue,oldValue) {
vm.show = newValue;
console.log(newValue);
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/components/sidebar/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<md-sidenav md-is-locked-open="vm.show" class="md-whiteframe-z2" layout-fill>
<md-sidenav md-component-id="sidebar" md-is-locked-open="$mdMedia('gt-xs')" class="md-sidenav-right md-whiteframe-z2" layout-fill>
<md-content>
<md-list>
<!-- List item #1 -->
Expand Down

0 comments on commit 0ad8cc8

Please sign in to comment.