-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[AppBar] Add iconStyleLeft prop #3668
Changes from all commits
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ import Paper from './paper'; | |
import PropTypes from './utils/prop-types'; | ||
import warning from 'warning'; | ||
|
||
function getStyles(props, state) { | ||
export function getStyles(props, state) { | ||
const { | ||
appBar, | ||
button: { | ||
|
@@ -98,6 +98,11 @@ const AppBar = React.createClass({ | |
*/ | ||
iconElementRight: React.PropTypes.element, | ||
|
||
/** | ||
* Override the inline-styles of the element displayed on the left side of the app bar. | ||
*/ | ||
iconStyleLeft: React.PropTypes.object, | ||
|
||
/** | ||
* Override the inline-styles of the element displayed on the right side of the app bar. | ||
*/ | ||
|
@@ -216,6 +221,7 @@ const AppBar = React.createClass({ | |
const { | ||
title, | ||
titleStyle, | ||
iconStyleLeft, | ||
iconStyleRight, | ||
showMenuIconButton, | ||
iconElementLeft, | ||
|
@@ -247,6 +253,8 @@ const AppBar = React.createClass({ | |
style: prepareStyles(Object.assign(styles.title, styles.mainElement, titleStyle)), | ||
}, title); | ||
|
||
const iconLeftStyle = Object.assign({}, styles.iconButtonStyle, iconStyleLeft); | ||
|
||
if (showMenuIconButton) { | ||
let iconElementLeftNode = iconElementLeft; | ||
|
||
|
@@ -260,15 +268,15 @@ const AppBar = React.createClass({ | |
} | ||
|
||
menuElementLeft = ( | ||
<div style={prepareStyles(Object.assign({}, styles.iconButtonStyle))}> | ||
<div style={prepareStyles(iconLeftStyle)}> | ||
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. Might this be a regression? Why even change these? 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. Yeah, but this is a breaking change. you shouldn't remove the 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. Oh, I'm sorry. Including a test, and re-commit again at a later date. 😵 |
||
{iconElementLeftNode} | ||
</div> | ||
); | ||
} else { | ||
const child = iconClassNameLeft ? '' : <NavigationMenu style={Object.assign({}, styles.iconButtonIconStyle)} />; | ||
menuElementLeft = ( | ||
<IconButton | ||
style={styles.iconButtonStyle} | ||
style={iconLeftStyle} | ||
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. ditto 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.
|
||
iconStyle={styles.iconButtonIconStyle} | ||
iconClassName={iconClassNameLeft} | ||
onTouchTap={this._onLeftIconButtonTouchTap} | ||
|
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.
you shouldn't do this either as it's resulting in calling prepareStyles twice. Please follow my comments as they are 😁