amsterdam-styled-components
amsterdam-styled-components copied to clipboard
Calling `themeColor` outside of styled CSS context (within Javascript / React Component)
Describe the bug
Calling themeColor
within a React Component (not within a styled CSS context). E.g. themeColor('primary', 'main')
, as documented here: https://amsterdam.github.io/amsterdam-styled-components/?path=/docs/ui-icon--colors. Throws the following TypeScript Error:
Type '({ theme }: { theme: ThemeInterface; }) => string' is not assignable to type 'string'. TS2322
To Reproduce
"@datapunt/asc-ui": "^0.23.0"
import React, { FC } from "react"
import { themeColor, ascDefaultTheme } from "@datapunt/asc-ui"
const C: FC = () => {
themeColor('primary', 'main')
// themeColor('primary', 'main')({ theme: ascDefaultContext }) // this works
}
Expected behavior
We would like to be able to call this without passing in the (default) theme. Having it pick up the actual theme supplied by ThemeProvider