Styled components are the best way to give some visual aid to your components. The heavy lifting should be done by a library, it can be either material design, bootstrap, semantic, etc... To adjust things or create custom components, you can use styled components. This gives the ability to keep your styles where your components are. The files structure is clean and the styles are not scattered around. This adds the simplicity desperately needed in the styling world.
Standard HTML elements
Source code viewer
import styled from 'styled-components'; const LoadMoreButtonWrapper = styled.div` text-align: center; `; export class MyClass extends PureComponent { render() { return ( <LoadMoreButtonWrapper> ... </LoadMoreButtonWrapper> ); } }Programming Language: ECMAScript
Existing ES6 components
Source code viewer
import styled from 'styled-components'; import Dimmer from 'semantic-ui-react/dist/commonjs/modules/Dimmer'; const Item = styled(Dimmer.Dimmable)` height: 300px; width: 200px; `; <Item as={Image} dimmed={active} dimmer={{ active, content }} onMouseEnter={this.handleShow} onMouseLeave={this.handleHide} src={`${APP_URL}/img/thumbnails/${this.props.thumbnail}.png`} />Programming Language: ECMAScript
Keyframes
Source code viewer
import styled, { keyframes } from 'styled-components'; const colorChangePulse = keyframes` 0% { color: #666; } 50% { color: lightgrey; } 100% { color: #666; } `; const FileIsBeingDownloaded = styled.span` animation: 2s ${colorChangePulse} linear infinite; `; render() { return ( <FileIsBeingDownloaded>...</FileIsBeingDownloaded> ); }Programming Language: ECMAScript
Variables/Properties
Source code viewer
const ListItem = styled.li` ${props => (props.isCurrentUser && 'font-style: italic;')} ${props => (props.isSelectedClient && 'background: #fce4ec;')} `; return ( <ListItem isCurrentUser={isCurrentUser} isSelectedClient={isSelectedClient} onClick={changeClient} onMouseMove={(e) => { setSelectedClient(idx, e); }} /> ); Programming Language: ECMAScript