generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix: 修正 prefixCls 在嵌套 ThemeProvider 中没有继承的问题
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* debug: true | ||
* iframe: true | ||
*/ | ||
import { Button } from 'antd'; | ||
import { ThemeProvider, createStyles } from 'antd-style'; | ||
|
||
const useStyles = createStyles(({ css, prefixCls }) => ({ | ||
button: css` | ||
.${prefixCls}-btn { | ||
background: pink; | ||
} | ||
`, | ||
})); | ||
|
||
const Demo = () => { | ||
const { styles } = useStyles(); | ||
return ( | ||
<div className={styles.button}> | ||
<Button>按钮</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
const App = () => { | ||
return ( | ||
<ThemeProvider appearance={'dark'} prefixCls={'a'}> | ||
<ThemeProvider appearance={'light'}> | ||
<Demo /> | ||
</ThemeProvider> | ||
</ThemeProvider> | ||
); | ||
}; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters