I have implemented styled components to change the text color by passing props.
<Button variant = 'colour' type="submit" form="myForm" className="submit-btn">
Submit
</Button>
export const FindFormModal = styled(Modal)`
.submit-btn {
width: 35%;
padding: 12px;
color:${props => props.variant === 'colour' ? 'blue' : 'green'}
border-radius: 3px;
font-weight: 500;
font-size: 16px;
margin: 0px 0 10px 0;
}
`
For some reason, when variant === 'colour'
, I get green
instead of blue
. Strangely, if it's not equal to 'colour'
, then it works as expected displaying blue
.
Shouldn't it be the other way around?