I have a component Box that looks like this:
const Box = ({ className, country }) => {
const status = myStatusFunction(country);
return (
<div className={className} status={status}>
{country}
</div>
);
};
I want to use this component in my view, but also add custom styling to it based on the status prop, so my styled.js looks like this:
import _Box from 'components/Box';
const Box = styled(_Box)`
${({ status }) => {
if (status === 'available') {
return css`
background-color: green;
`;
}
return css`
background-color: red;
`;
}}
`
The issue here is that the status is undefined here, so my question is – can you somehow access the status prop?