menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress!

Channels
Team

append classname to body

September 5, 2017 at 6:16pm

append classname to body

September 5, 2017 at 6:16pm
We have an app and the body color on most pages is blue. But on two pages we want the body color to change to another color.... Is this possible with a pure implementation of styled components? Or should we just append a classname to the body on those pages?

September 5, 2017 at 7:25pm
This is probably more relevant to the general styled-components channel rather than this stylelint-processor channel. But what about using props? Pass a prop to the component on those two pages, and use that as a boolean in an interpolation to determine the color, such as `color: ${props => props.flag ? 'red' : 'blue'}`