mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 14:39:52 +03:00
2f4f6db133
no issue - add ember-suave dependency - upgrade grunt-jscs dependency - add a new .jscsrc for the client's tests directory that extends from client's base .jscsrc - separate client tests in Gruntfile jscs task so they pick up the test's .jscsrc - standardize es6 usage across client
39 lines
1003 B
JavaScript
39 lines
1003 B
JavaScript
import Ember from 'ember';
|
|
|
|
const {Component, computed, inject} = Ember;
|
|
|
|
/*
|
|
This cute little component has two jobs.
|
|
|
|
On desktop, it toggles autoNav behaviour. It tracks
|
|
that state via the maximise property, and uses the
|
|
state to render the appropriate icon.
|
|
|
|
On mobile, it renders a closing icon, and clicking it
|
|
closes the mobile menu
|
|
*/
|
|
export default Component.extend({
|
|
classNames: ['gh-menu-toggle'],
|
|
|
|
mediaQueries: inject.service(),
|
|
isMobile: computed.reads('mediaQueries.isMobile'),
|
|
maximise: false,
|
|
|
|
iconClass: computed('maximise', 'isMobile', function () {
|
|
if (this.get('maximise') && !this.get('isMobile')) {
|
|
return 'icon-maximise';
|
|
} else {
|
|
return 'icon-minimise';
|
|
}
|
|
}),
|
|
|
|
click() {
|
|
if (this.get('isMobile')) {
|
|
this.sendAction('mobileAction');
|
|
} else {
|
|
this.toggleProperty('maximise');
|
|
this.sendAction('desktopAction');
|
|
}
|
|
}
|
|
});
|