-
Notifications
You must be signed in to change notification settings - Fork 39
✨ feat: support antd v6 cssVar #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
cd838b0
35732f5
a1bd816
cb9936f
968626e
b922a94
f739af5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| import { useMemo } from 'react'; | ||
|
|
||
| import { AntdTheme } from '@/types'; | ||
| import { theme } from 'antd'; | ||
| import { useAntdStylish } from './useAntdStylish'; | ||
| import { useAntdToken } from './useAntdToken'; | ||
|
|
||
| export const useAntdTheme = (): AntdTheme => { | ||
| const token = useAntdToken(); | ||
| const { token, cssVar } = theme.useToken(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain验证 theme.useToken() 返回 cssVar 确认 antd v6.0.0-alpha.1 的 theme.useToken() 确实返回 cssVar 属性。 🌐 Web query: 💡 Result: In Ant Design v6.0.0-alpha.1, the However, it's important to note that Ant Design's theming system does not natively support the use of CSS variables within tokens. This limitation arises because the theming algorithm does not interpret CSS variables, which can lead to issues when attempting to use them in tokens. (github.com) To incorporate CSS variables into your Ant Design theming, you can utilize the In summary, while Citations:
修复 theme.useToken() 解构 Ant Design v6.0.0-alpha.1 中, 请处理以下位置:
🤖 Prompt for AI Agents |
||
| const stylish = useAntdStylish(); | ||
|
|
||
| return useMemo(() => ({ ...token, stylish }), [token, stylish]); | ||
| return useMemo(() => ({ ...token, stylish, cssVar }), [token, stylish, cssVar]); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.