-
-
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
Improve styling of flat buttons #643
Conversation
a3569c9
to
7c20de6
Compare
@troutowicz I did some research, and I have feedback on the PR. Hope it will be valuable to you. style={this.mergeAndPrefix(
styles.root,
((this.state.hovered || this.state.isKeyboardFocused) && !this.props.disabled) && styles.rootWhenHovered,
this.props.style,
((this.state.hovered || this.state.isKeyboardFocused) && !this.props.disabled) && this.props.hoverStyle
)} And these will be the event handlers: _handleMouseOver (e) {
this.setState({hovered: true});
if (this.props.onMouseOver) {
this.props.onMouseOver(e);
}
},
_handleMouseOut (e) {
this.setState({hovered: false});
if (this.props.onMouseOut) {
this.props.onMouseOut(e);
}
},
_handleKeyboardFocus (e, isKeyboardFocused) {
this.setState({isKeyboardFocused});
} Notice that we no longer check if the enhanced button is focused with a keyboard since we always want the hovered state to be applied when the mouse is actually over the button. I would also add an onBlur handler that would as well set |
7c20de6
to
7544fd2
Compare
@pomerantsev Thanks for the critique. Your suggestions make sense, I will make the changes later today... I wasn't happy with the Also, I recently updated this PR to instead have |
Great. |
4949d2e
to
cd8794a
Compare
@pomerantsev Had some free time on lunch, I have updated the PR. |
@troutowicz Thanks. Tested it quickly, looks good. |
The project definitely needs a test suite. I personally have been testing my changes inside a personal project that uses the various components that I submit a PR for. Side note: My project uses mochify, and has worked well for my component tests thus far. (my project's tests) |
Same with me - I've also been testing stuff inside a different project. |
cd8794a
to
05dd431
Compare
05dd431
to
8059858
Compare
@troutowicz @pomerantsev There is an issue created for adding a test suite #396 - maybe we can have a discussion there and come up with a decision on which test suite to use? |
Improve styling of flat buttons
Looks good - Thanks @troutowicz & @pomerantsev 👍 |
If this gets a thumbs up, I will do the same for raised buttons.