-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Disabled Prop and Styles to DropDownMenu #1406
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ let DropDownMenu = React.createClass({ | |
displayMember: React.PropTypes.string, | ||
valueMember: React.PropTypes.string, | ||
autoWidth: React.PropTypes.bool, | ||
disabled: React.PropTypes.bool, | ||
onChange: React.PropTypes.func, | ||
menuItems: React.PropTypes.array.isRequired, | ||
menuItemStyle: React.PropTypes.object, | ||
|
@@ -65,6 +66,7 @@ let DropDownMenu = React.createClass({ | |
|
||
getStyles(){ | ||
let zIndex = 5; // As AppBar | ||
let disabled = this.props.disabled; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand what const is, but not the purpose of your line note. Const is not used anywhere else in this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mjhasbach Understood. We're trying to update our files with // this.props is immutable within the context of this so we should treat it as such
const { style, children } = this.props; if you are going to expand There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make sure we're on the same page... The purpose of Therefore, are you saying that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More or less. It should be declared There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool. I made the requested change. |
||
let spacing = this.context.muiTheme.spacing; | ||
let accentColor = this.context.muiTheme.component.dropDownMenu.accentColor; | ||
let backgroundColor = this.context.muiTheme.component.menu.backgroundColor; | ||
|
@@ -78,7 +80,7 @@ let DropDownMenu = React.createClass({ | |
outline: 'none', | ||
}, | ||
control: { | ||
cursor: 'pointer', | ||
cursor: disabled ? 'not-allowed' : 'pointer', | ||
position: 'static', | ||
height: '100%', | ||
}, | ||
|
@@ -102,7 +104,7 @@ let DropDownMenu = React.createClass({ | |
paddingLeft: spacing.desktopGutter, | ||
top: 0, | ||
opacity: 1, | ||
color: this.context.muiTheme.palette.textColor, | ||
color: disabled ? this.context.muiTheme.palette.disabledColor : this.context.muiTheme.palette.textColor, | ||
}, | ||
underline: { | ||
borderTop: 'solid 1px ' + accentColor, | ||
|
@@ -240,7 +242,9 @@ let DropDownMenu = React.createClass({ | |
}, | ||
|
||
_onControlClick() { | ||
this.setState({ open: !this.state.open }); | ||
if (!this.props.disabled) { | ||
this.setState({ open: !this.state.open }); | ||
} | ||
}, | ||
|
||
_onKeyDown(e) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add the default value false in
getDefaultProps
so that it's straightforward?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks