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 Usage #1

Open
pkrawc opened this issue Oct 12, 2020 · 1 comment
Open

Styled Components Usage #1

pkrawc opened this issue Oct 12, 2020 · 1 comment

Comments

@pkrawc
Copy link

pkrawc commented Oct 12, 2020

Hey Joe,

Thought I would poke around your portfolio a bit and offer some advice, feel free to ignore.

You're importing the styled-components library but not making any use of it. I don't see a problem in just writing styles as css modules but styled components is a really powerful way to write css inside your components. I've been using styled components since it came out like 4 years ago and it has only gotten better over time.

Potentially a good learning experience would be to covert all your existing styles into component architecture, basically moving the css from separate files into the components themselves. Styled components are commonly written like a wrapper around the normal DOM node.

// CSS goes here. It's a template literal so every interpolation point
// has access to the props of the component.
const Header = styled.header`
  background-color: ${props => props.light ? "white" : "black"};
`

// Then the component can be used like any other
<Header light>
  I'm a header component
</Header>
@jodyanna
Copy link
Owner

jodyanna commented Oct 15, 2020 via email

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

No branches or pull requests

2 participants