We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
以Button组件为例,封装成自定义组件后,createStyles可以获取到prefixCls的值。直接使用Button组件获取到的prefixCls就是默认值ant
import { Button } from 'antd' import { createStyles, ThemeProvider } from 'antd-style' import './App.css' const useStyles = createStyles(({ token, css, prefixCls }) => { console.log('prefixCls: ', prefixCls); return { override: css` &.${prefixCls}-btn { background-color: ${token.colorWarning}; } `, } }); const Demo = ({ text }: { text?: string }) => { const { styles } = useStyles(); return <Button className={styles.override}>{text ?? 'override to warning color'}</Button>; }; function App() { const { styles } = useStyles(); return ( <ThemeProvider prefixCls={'abc'}> <Demo text={'prefixCls to abc'} /> <Button className={styles.override}>abc</Button> {/* <ThemeProvider prefixCls={'efg'}> <Demo text={'prefixCls to efg'} /> <Button className={styles.override}>qqq</Button> </ThemeProvider> */} </ThemeProvider> ) } export default App
The text was updated successfully, but these errors were encountered:
No branches or pull requests
🐛 bug 描述
以Button组件为例,封装成自定义组件后,createStyles可以获取到prefixCls的值。直接使用Button组件获取到的prefixCls就是默认值ant
💻 复现代码
© 版本信息
🚑 其他信息
The text was updated successfully, but these errors were encountered: