-
-
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
[Table] Remove style-propable mixin #3227
Conversation
}, adjustForCheckbox && [ | ||
<TableRowColumn key={`fpcb${rowNumber}`} style={{width: 24}} />, | ||
...React.Children.toArray(child.props.children), | ||
])); |
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.
More LOC but a bit more readable 😁
const footerRows = React.Children.map(children, (child, rowNumber) => {
const newChildProps = {
displayBorder: false,
key: `f-${rowNumber}`,
rowNumber: rowNumber,
style: Object.assign({}, styles.cell, child.props.style),
};
let newDescendants;
if (adjustForCheckbox) {
newDescendants = [
<TableRowColumn key={`fpcb${rowNumber}`} style={{width: 24}} />,
...React.Children.toArray(child.props.children),
];
}
return React.cloneElement(child, newChildProps, newDescendants);
});
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 good! 👍
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.
crap, I forgot the return
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 noticed, it's okay 😁. I found another issue with this PR too...
|
All good for me 👍. |
Awesome work @newoga 👍 You're doing a great job 😄 |
[Table] Remove style-propable mixin
This one was tough. A few of these components I refactored a good bit because there were loops in which we were recomputing the same style from
getStyles()
for each item. I've changed it sogetStyles()
only gets called once in each render which should help performance.