Skip to content

Avoid nested classes#11

Merged
daveyholler merged 3 commits intodaveyholler:emotional-tabsfrom
elizabetdev:tabs-avoid-nested-classes
Oct 19, 2022
Merged

Avoid nested classes#11
daveyholler merged 3 commits intodaveyholler:emotional-tabsfrom
elizabetdev:tabs-avoid-nested-classes

Conversation

@elizabetdev
Copy link
Copy Markdown

Summary

This PR tries to avoid nested classes like the following one in favor of a more JS approach.

euiTab: css`
  .euiTab__content {
    color: ${euiTheme.colors.text};

    &:hover {
      text-decoration: underline;
    }
  }

Comment on lines +89 to +98
const tabItems = React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
return cloneElementWithCss(child, {
// we're passing the parent `size` and `expand` down to the children
size: size,
expand: expand,
...child.props,
});
}
});
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Basically, I'm copying some props from the parent to the children because it makes it easier to apply the styles.

@elizabetdev elizabetdev mentioned this pull request Oct 19, 2022
38 tasks
@daveyholler daveyholler merged commit 18914f8 into daveyholler:emotional-tabs Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants