Skip to content

Instantly share code, notes, and snippets.

@orrybaram
Last active August 10, 2018 21:01
Show Gist options
  • Save orrybaram/1c7d0c9c4d788db0c672e82001114ed5 to your computer and use it in GitHub Desktop.
Save orrybaram/1c7d0c9c4d788db0c672e82001114ed5 to your computer and use it in GitHub Desktop.
Naming Styled Components
const Navigation = styled.div`/* styles */`;
const Navigation = () => (
<Navigation />
);
// => JS interpreter: "I can't believe you've done this x_x"
import Header from 'Components/Header';
const Navigation = () => (
<div className="Navigation">
<Header>{headerContent}</Header>
<div className="Navigation__Content">{content}</div>
</div>
);
import Header from 'Components/Header';
import { Wrapper, Content } from './styles';
const Navigation = () => (
<Wrapper>
<Header>{headerContent}</Header>
<Content>{content}</Content>
</Wrapper>
);
import Header from 'Components/Header';
import { StyledNavigation, Content } from './styles';
const Navigation = () => (
<StyledNavigation>
<Header>{headerContent}</Header>
<Content>{content}</Content>
</StyledNavigation>
);
import Header from 'Components/Header';
import * as S from './styles';
const Navigation = () => (
<S.Navigation>
<Header>{headerContent}</Header>
<S.Content>{content}</S.Content>
</S.Navigation>
);
import Header from 'Components/Header';
const S = {};
S.Navigation = styled.div`/* styles */`;
S.Content = styled.div`/* styles */`;
const Navigation = () => (
<S.Navigation>
<Header>{headerContent}</Header>
<S.Content>{content}</S.Content>
</S.Navigation>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment