I have a component that accepts a prop that runs another component. It looks like this:
const IconBase = styled.div`
// Css Styles Go Here
`;
const Icon = props => (
<IconBase>
<props.name />
</IconBase>
);
This component works as follows: <Icon name={Facebook} /> -- which is basically equivalent to the following:
<Icon><Facebook /></Icon>
The <Facebook /> component comes from react-icons.
Now, this all works as I wish. What I want to do now is run a check in Styled-Components for the name prop and then output the appropriate background color. Something like this:
${props => props.name === "Facebook" && `background-color: #3b5998`}
The problem is, I don't know how to do the conditional check in Styled-Components. Checking for Facebook won't work -- as I'm not passing a String to the name component. What then, should I check for?