Skip to content
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

Merged
merged 1 commit into from
Feb 8, 2016
Merged

Conversation

newoga
Copy link
Contributor

@newoga newoga commented Feb 7, 2016

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 so getStyles() only gets called once in each render which should help performance.

}, adjustForCheckbox && [
<TableRowColumn key={`fpcb${rowNumber}`} style={{width: 24}} />,
...React.Children.toArray(child.props.children),
]));
Copy link
Member

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);
});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

Copy link
Member

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

Copy link
Contributor Author

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...

@newoga newoga added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed PR: Needs Review labels Feb 8, 2016
@newoga
Copy link
Contributor Author

newoga commented Feb 8, 2016

@newoga newoga added PR: Needs Review and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels Feb 8, 2016
@oliviertassinari
Copy link
Member

All good for me 👍.

@alitaheri
Copy link
Member

Awesome work @newoga 👍 You're doing a great job 😄

alitaheri added a commit that referenced this pull request Feb 8, 2016
[Table] Remove style-propable mixin
@alitaheri alitaheri merged commit eb4435c into mui:master Feb 8, 2016
@newoga newoga deleted the #2852/table branch February 8, 2016 16:26
@zannager zannager added the component: table This is the name of the generic UI component, not the React module! label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants