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

Change 'too many classes' error to recommend attrs for frequently changed styles #1213

Merged
merged 6 commits into from
Oct 24, 2017

Conversation

lukebelliveau
Copy link
Contributor

No description provided.

@mxstbr-bot
Copy link

mxstbr-bot commented Oct 7, 2017

Warnings
⚠️ There are library changes, but not tests. That's OK as long as you're refactoring existing code
Messages
📖 ✅ Jest tests passed

Generated by 🚫 dangerJS

@lukebelliveau lukebelliveau changed the title Changed 'too many classes' error to recommend attrs for frequently changed styles Change 'too many classes' error to recommend attrs for frequently changed styles Oct 7, 2017
kitten
kitten previously requested changes Oct 7, 2017
console.warn(`Over ${LIMIT} classes were generated for component ${displayName}. ` +
'Consider using style property for frequently changed styles.\n' +
console.warn(`Over ${LIMIT} classes were generated for component ${displayName}. \n` +
'Consider using the attrs property, together with a style object for frequently changed styles.\n' +
Copy link
Member

Choose a reason for hiding this comment

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

*attrs property => method

Otherwise lgtm :)

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Great work @lukebelliveau, thank you for all these contributions! One tiny nitpick then we'll ship this 👌

' const StyledComp = styled.div`width: 100%;`\n' +
' <StyledComp style={{ background: background }} />')
' const Component = styled.div.attrs({\n' +
' style: ({ background }) => {\n' +
Copy link
Member

Choose a reason for hiding this comment

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

There is a pair of parenthesis missing here:

style: ({ background }) => {
  background,
}

// should be

style: ({ background }) => ({
  background,
})

Copy link
Member

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks so much!

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.

4 participants