-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Menu][DropDownMenu][SelectField] Add menuItemStyle and menuItemSelectedStyle properties #5389
[Menu][DropDownMenu][SelectField] Add menuItemStyle and menuItemSelectedStyle properties #5389
Conversation
👍 I was just trying to use what you had in the previous PR and wondering why it wasn't working. Started debugging and realized I don't have the code yet. Duh'. Thank you for this. Finally I can easily put all the pink to rest. |
I feel like we should change the API for the We could have something close to the |
What needs to be revised here? I'd love to help. I agree that creating hooks for every deep down component will probably not be a great long term solution, but it is annoying that there is no current way to change the colors of those selected menu items currently, without css. This PR seems to be a good solution until API changes can be agreed upon. |
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.
I'm quite worried by the overhead of adding a new property everytime one user want to access a deep down component. I don't think that we should make everybody pay for it.
We could have something close to the menuProps.
I have changed my mind as the style
property requires some specific logic.
My only concern regarding merging this PR is with the breaking change. I would rather keep the selectedMenuItemStyle
property.
@chrisajimenez Do you have enough information to continue that PR? Thanks for proposing your help.
@@ -315,6 +325,8 @@ class DropDownMenu extends Component { | |||
style={menuStyle} | |||
listStyle={listStyle} | |||
onItemTouchTap={this.handleItemTouchTap} | |||
menuItemStyle={menuItemStyle} | |||
menuItemSelectedStyle={menuItemSelectedStyle} |
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.
What about?
selectedMenuItemStyle={selectedMenuItemStyle}
@@ -112,10 +120,6 @@ class Menu extends Component { | |||
/** @ignore */ | |||
onKeyDown: PropTypes.func, | |||
/** | |||
* Override the inline-styles of selected menu items. | |||
*/ | |||
selectedMenuItemStyle: PropTypes.object, |
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.
I would rather keep that name to not introduce breaking changes.
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.
That looks good aside from my two small comments.
@@ -111,7 +115,7 @@ class Menu extends Component { | |||
onItemTouchTap: PropTypes.func, | |||
/** @ignore */ | |||
onKeyDown: PropTypes.func, | |||
/** | |||
/** |
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.
space typo
@@ -17,17 +17,27 @@ function getStyles(props, context, state) { | |||
|
|||
const {open} = state; | |||
|
|||
const {position} = props; |
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.
Looks like change on the Snackbar
wasn't intended to be in that PR.
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.
oh no, sry.
that were the changes of #5437
because i already merged it into master in my branch...
=> set it to actual content of Snackbar.js
…t travis doesnt like it)
@DoubleU23 Thanks! |
related PR's
continuation/extension of PR #5379
supersedes PR #5091
related issues
#5166, #3388
DropDownMenu
/SelectField
and the underlyingMenu
now have additional props:
menuItemStyle
andmenuItemSelectedStyle
menuItemSelectedStyle
supersedes
selectedMenuItemStyle
(it was never applied)prop to overwrite the style of the selected menuItem
menuItemStyle
not neccessary and may be removed.
i added this aswell, just for convention.
my thoughts on this:
f.e.: if the menuItems are rendered by a helper function from a seperate file...
if a user wants to style the selecteMenuItem he probably wants to style the other items aswell on the same file/location and not in the helper.