diff --git a/docs/demos/ThemeProvider/_app.tsx b/docs/demos/ThemeProvider/_app.tsx index a0d297b7..76ae127d 100644 --- a/docs/demos/ThemeProvider/_app.tsx +++ b/docs/demos/ThemeProvider/_app.tsx @@ -1,5 +1,5 @@ import { Space } from 'antd'; -import { useTheme } from 'antd-style'; +import { createStyles, useTheme } from 'antd-style'; import { FC } from 'react'; interface AppProps { @@ -7,11 +7,22 @@ interface AppProps { tokenName?: string; } -const App: FC = ({ title, tokenName }) => { +const useStyle = createStyles(({ cx, cssVar }, { tokenName }: AppProps) => ({ + box: { + width: 32, + height: 32, + background: { ...(cssVar as any) }[tokenName!] || 'pink', + borderRadius: 16, + }, +})); + +const App: FC = (props) => { + const { title, tokenName } = props; const token = useTheme(); // @ts-ignore const tokenColor = tokenName ? token[tokenName] : token.colorPrimary; + const { styles } = useStyle(props); return ( @@ -32,6 +43,7 @@ const App: FC = ({ title, tokenName }) => { borderRadius: 16, }} /> +
{tokenColor || 'None'}
diff --git a/docs/demos/api/createStyles/default.tsx b/docs/demos/api/createStyles/default.tsx index 26f46f35..eca0027b 100644 --- a/docs/demos/api/createStyles/default.tsx +++ b/docs/demos/api/createStyles/default.tsx @@ -3,7 +3,7 @@ * defaultShowCode: true */ import { SmileOutlined } from '@ant-design/icons'; -import { Button, Space } from 'antd'; +import { Button, Space, version } from 'antd'; import { createStyles } from 'antd-style'; const useStyles = createStyles(({ cssVar, css, cx }) => { @@ -38,7 +38,7 @@ const App = () => { const { styles } = useStyles(); return ( -
+