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

Styled components example consistency #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

darcar31
Copy link
Collaborator

@darcar31 darcar31 commented Mar 2, 2020

This PR requests a couple changes

  • Before the theme usage was introduced, there were a couple examples with colors being pulled from props instead of the default theme which was a little confusing.

  • When building the BUTTON_MODIFIERS object after themes were introduced, most of the colors were coming from the destructed theme, but there were a couple examples that were pulling the colors off of props. I'm not sure if this was intended, but I found it a little confusing. I don't have any experience with modifiers and I was unsure if the two methods were separate concepts being introduced or two ways to do the same thing.

  • Some of the modifiers code was missing indentation

@emmabostian
Copy link
Owner

Thanks for the indentation! For the props usage, was this before or after I created defaultTheme? If it's before, I can definitely explain props a bit better but I want to introduce that paradigm as it's a core concept of styled components! However if it was confusing that's a good indication that I need to explain a bit better! :)

@@ -549,7 +549,7 @@ const Button = styled.button`
}

&:focus {
outline: 3px solid ${props => props.theme.primaryHoverColor};
outline: 3px solid ${defaultTheme.primaryHoverColor};
Copy link
Collaborator Author

@darcar31 darcar31 Mar 4, 2020

Choose a reason for hiding this comment

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

This usage of props and the next one are being used after the defaultTheme is introduced, but before the extensible themes are introduced as a prop and the prop syntax is explained later down ~line 926.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah so you think I should just clarify why we're doing these changes a bit more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You do a great job of explaining the props changes, just a little bit after this part of the example.

@@ -943,11 +943,11 @@ const BUTTON_MODIFIERS = {
`,
warning: ({ theme }) => `
background-color: ${theme.warningColor};
color: ${props => props.theme.textColorInverted};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, the props are being used after being introduced, but are being used sometimes in conjunction with the destructuring syntax which is a bit confusing:

background-color: ${theme.warningColorHover}; outline: 3px solid ${props => props.theme.warningColorHover};

But I can definitely understand if you want to expose the reader to both.

Copy link
Owner

Choose a reason for hiding this comment

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

OH you're right! I missed this :)

@darcar31
Copy link
Collaborator Author

darcar31 commented Mar 4, 2020

I tried to explain better by pointing out specific lines :). Let me know if it doesn't make any sense, or if you want to just scrap the pr!

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