Skip to content

Commit

Permalink
Minor refactoring/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
negomi committed Apr 3, 2018
1 parent cfcd8db commit 4a39155
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion example/src/example.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ main {
padding: 3em 2em;
text-align: center;
background: #b4bad2;
overflow: scroll;
overflow: auto;
}

h1 {
Expand Down
4 changes: 0 additions & 4 deletions lib/baseStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ var styles = {
display: 'block',
outline: 'none'
};
},

burgerIcon: function burgerIcon(isOpen, width, right) {
return {};
}
};

Expand Down
4 changes: 2 additions & 2 deletions lib/menuFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ exports['default'] = function (styles) {
key: 'getStyle',
value: function getStyle(style, index) {
var width = this.props.width;
if (typeof width !== 'string') width = width + 'px';

return style(this.state.isOpen, width, this.props.right, index);
var formattedWidth = typeof width !== 'string' ? width + 'px' : width;
return style(this.state.isOpen, formattedWidth, this.props.right, index);
}
}, {
key: 'listenForClose',
Expand Down
6 changes: 1 addition & 5 deletions src/baseStyles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

let styles = {
const styles = {
overlay(isOpen) {
return {
position: 'fixed',
Expand Down Expand Up @@ -63,10 +63,6 @@ let styles = {
display: 'block',
outline: 'none'
};
},

burgerIcon(isOpen, width, right) {
return {};
}
};

Expand Down
7 changes: 3 additions & 4 deletions src/menuFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ export default styles => {
}

getStyle(style, index) {
let width = this.props.width;
if (typeof width !== 'string') width = `${width}px`;

return style(this.state.isOpen, width, this.props.right, index);
const { width } = this.props;
const formattedWidth = typeof width !== 'string' ? `${width}px` : width;
return style(this.state.isOpen, formattedWidth, this.props.right, index);
}

listenForClose(e) {
Expand Down

0 comments on commit 4a39155

Please sign in to comment.