Skip to content
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

Merged
merged 3 commits into from
Aug 14, 2015

Conversation

mjhasbach
Copy link
Contributor

Fixes #1294

@mjhasbach mjhasbach force-pushed the DropDownMenu.props.disabled branch from be843a0 to bcaf95b Compare August 13, 2015 17:50
@@ -65,6 +66,7 @@ let DropDownMenu = React.createClass({

getStyles(){
let zIndex = 5; // As AppBar
let disabled = this.props.disabled;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjhasbach Understood. We're trying to update our files with const where appropriate and it looks like you happened to find a file we haven't touched yet. When accessing this.props you should always write

// 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 this.props.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 disabled is to make property value ternary evaluations of the object literal styles more terse. Because this.props.disabled is a React.PropTypes.bool, mutating disabled would not mutate this.props.disabled.

Therefore, are you saying that disabled should be declared with const instead of let to make it clear that disabled should not be mutated (even though doing so would not mutate this.props)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less. It should be declared const because disabled is not and should probably not be mutated (yes because he come from a prop which is a source of truth).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I made the requested change.

hai-cea pushed a commit that referenced this pull request Aug 14, 2015
Added Disabled Prop and Styles to DropDownMenu
@hai-cea hai-cea merged commit 03471fe into mui:master Aug 14, 2015
@hai-cea
Copy link
Member

hai-cea commented Aug 14, 2015

Thanks @mjhasbach @oliviertassinari !

@Kagami
Copy link

Kagami commented Aug 14, 2015

Thanks!

@zannager zannager added the package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5. label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: styles Specific to @mui/styles. Legacy package, @material-ui/styled-engine is taking over in v5.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SelectField ignores disabled property
6 participants