-
-
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
[Card] Expand on Click #1806
[Card] Expand on Click #1806
Conversation
Just did a fixup on the first commit, if anyone tried the previous version I had forgotten to commit modifications and it didn't work, sorry about that. |
@hugo-agbonon I assume that the Otherwise, this looks fine to me from a high-level (yet to run the code though). @droberts84 @MichaelTaylor3D you guys have any feedback on this? |
@@ -100,7 +93,7 @@ const CardExpandable = React.createClass({ | |||
let expandableBtn = ( | |||
<IconButton | |||
style={mergedStyles} | |||
onClick={this._onExpanding}> | |||
onClick={this.props.onExpanding}> |
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.
Why do we have a onClick
and not a onTouchTap
?
I replaced the onClick events by onTouchTap events, and renamed @shaurya947 That's right, any direct child component of |
Sounds good @hugo-agbonon! Thanks! |
@@ -31,6 +32,10 @@ const Card = React.createClass({ | |||
} | |||
if (this.state.expanded === false && currentChild.props.expandable === true) | |||
return; | |||
if (currentChild.props.actAsExpander === true) { | |||
currentChild.props.onTouchTap = this._onExpandable; |
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.
@hugo-agbonon this will not work with React 0.14. Props can no longer be mutated.. see here: https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#breaking-changes
I'll try to fix this.
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.
@shaurya947 @cgestes already wrote a fix, see #1868 / #1872,
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.
My bad, missed that. Merged now.
This is an implementation proposal for #1354 : To be able to expand card by clicking on an element such as CardHeader, rather than only being able to do it using the CardExpandable button.
This adds a new
expander
prop for Card child components, which triggers the expand on click.I also updated the card documentation as to provide a demo of the proposed use.