generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: support iconPrefixCls and prefixCls on createStyles
- Loading branch information
Showing
14 changed files
with
171 additions
and
150 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
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,32 @@ | ||
import { SmileOutlined } from '@ant-design/icons'; | ||
import { Button, ConfigProvider } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
|
||
const useStyles = createStyles(({ css, prefixCls, iconPrefixCls }) => ({ | ||
button: css` | ||
&.${prefixCls}-btn { | ||
background: lightsteelblue; | ||
border: none; | ||
color: royalblue; | ||
} | ||
.${iconPrefixCls} { | ||
color: darkblue; | ||
} | ||
`, | ||
})); | ||
|
||
const App = () => { | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<Button className={styles.button} icon={<SmileOutlined />}> | ||
CP Button | ||
</Button> | ||
); | ||
}; | ||
export default () => ( | ||
<ConfigProvider prefixCls={'cp'} iconPrefixCls={'cpicon'}> | ||
<App /> | ||
</ConfigProvider> | ||
); |
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
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
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
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 |
---|---|---|
|
@@ -35,4 +35,5 @@ export interface StyleEngine { | |
* @description 当前组件的 CSS 类名前缀 | ||
*/ | ||
prefixCls?: string; | ||
iconPrefixCls?: string; | ||
} |
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
Oops, something went wrong.