mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 04:07:27 +00:00
UX: improve hamburger in desktop
- dock underneath header - click anywhere to get it to go away
This commit is contained in:
parent
b736b56e97
commit
6c08bd4265
@ -4,6 +4,23 @@ export default Ember.Component.extend({
|
||||
classNameBindings: ['visible::slideright'],
|
||||
elementId: 'hamburger-menu',
|
||||
|
||||
visibilityChanged: function(){
|
||||
if(this.get("visible")) {
|
||||
$('html').on('click.close-humburger', (e) => {
|
||||
const $target = $(e.target);
|
||||
if ($target.closest('.dropdown.categories').length > 0) {
|
||||
return;
|
||||
}
|
||||
console.log(e.toElement || e.relatedTarget || e.target);
|
||||
this.set("visible", false);
|
||||
$('html').off('click.close-humburger');
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
$('html').off('click.close-humburger');
|
||||
}
|
||||
}.observes("visible"),
|
||||
|
||||
@computed()
|
||||
showKeyboardShortcuts() {
|
||||
return !Discourse.Mobile.mobileView && !this.capabilities.touch;
|
||||
@ -43,6 +60,7 @@ export default Ember.Component.extend({
|
||||
$('body').off('keydown.discourse-hambuger');
|
||||
$('body').off('swipeleft.discourse-hamburger');
|
||||
$('body').off('swiperight.discourse-hamburger');
|
||||
$('body').off('click.close-humburger');
|
||||
},
|
||||
|
||||
@computed()
|
||||
|
@ -1,4 +1,5 @@
|
||||
{{render "header"}}
|
||||
{{hamburger-menu visible=hamburgerVisible showKeyboardAction="showKeyboardShortcutsHelp"}}
|
||||
|
||||
<div id="main-outlet" class="wrap">
|
||||
<div class="container">
|
||||
@ -19,4 +20,3 @@
|
||||
{{render "topic-entrance"}}
|
||||
{{render "composer"}}
|
||||
|
||||
{{hamburger-menu visible=hamburgerVisible showKeyboardAction="showKeyboardShortcutsHelp"}}
|
||||
|
@ -1,5 +1,7 @@
|
||||
{{#if visible}}
|
||||
<a href {{action "close"}} class='close-hamburger'>{{fa-icon 'times'}}</a>
|
||||
<div class='hamburger-header clearfix'>
|
||||
<a href {{action "close"}} class='close-hamburger'>{{fa-icon 'times'}}</a>
|
||||
</div>
|
||||
<ul class="location-links">
|
||||
{{#if currentUser.staff}}
|
||||
<li>
|
||||
|
@ -9,7 +9,7 @@
|
||||
transition: 0.3s ease-in-out;
|
||||
@include transform(translateX(0));
|
||||
|
||||
box-shadow: 4px 0 4px 5px rgba(0,0,0, .25);
|
||||
box-shadow: 0 4px 4px 4px rgba(0,0,0, .25);
|
||||
padding: 0.5em 0.5em 0.5em 0.5em;
|
||||
width: 300px;
|
||||
|
||||
@ -17,10 +17,11 @@
|
||||
float: right;
|
||||
color: dark-light-choose(scale-color($header_primary, $lightness: 50%), $header_primary);
|
||||
font-size: 1.5em;
|
||||
margin-right: 0.1em;
|
||||
margin-right: 0.5em;
|
||||
margin-top: 0.1em;
|
||||
}
|
||||
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
|
@ -17,6 +17,7 @@
|
||||
@import "desktop/user";
|
||||
@import "desktop/history";
|
||||
@import "desktop/queued-posts";
|
||||
@import "desktop/hamburger";
|
||||
|
||||
/* These files doesn't actually exist, they are injected by DiscourseSassImporter. */
|
||||
|
||||
|
8
app/assets/stylesheets/desktop/hamburger.scss
Normal file
8
app/assets/stylesheets/desktop/hamburger.scss
Normal file
@ -0,0 +1,8 @@
|
||||
.docked #hamburger-menu {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#hamburger-menu {
|
||||
position: absolute;
|
||||
top: 63px
|
||||
}
|
0
app/assets/stylesheets/mobile/hamburger.scss
Normal file
0
app/assets/stylesheets/mobile/hamburger.scss
Normal file
Loading…
x
Reference in New Issue
Block a user