I have the following Styled-Map object:
export const colorProps = styledMap({
default: yellow,
primary: blue,
secondary: green,
})
I use it as follows in a Styled Component:
const MyComponent = styled.div`
...
background-color: ${colorProps};
...
`
This then allows me to use my component as follows:
<MyComponent primary />
<MyComponent secondary />
And it will use the appropriate color value for the background-color.
So far, so good.
But now I would like to use polished to darken the background-color on hover -- something like this:
&:hover {
background-color: ${darken(0.1, colorProps)};
}
But this does not work. It throws an error.
Error: Passed an incorrect argument to a color function, please pass a string representation of a color.
I am wondering, therefore, if anyone has any ideas on how I can use styled-map in conjunction with polished?