forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: default add resetIcon Style (ant-design#41208)
* feat: default add resetIcon Style chore: remove test: add case feat(App): icon reset style feature Revert "feat(App): icon reset style feature" This reverts commit be69055. Revert "chore: remove" This reverts commit 417d5f9. chore: update chore: update * chore: update * chore: resolve import * chore: update code style
- Loading branch information
Showing
5 changed files
with
66 additions
and
31 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 |
---|---|---|
@@ -1,31 +1,2 @@ | ||
import { useStyleRegister } from '@ant-design/cssinjs'; | ||
import type { CSPConfig } from '..'; | ||
import { resetIcon } from '../../style'; | ||
import { useToken } from '../../theme/internal'; | ||
|
||
const useStyle = (iconPrefixCls: string, csp?: CSPConfig) => { | ||
const [theme, token] = useToken(); | ||
|
||
// Generate style for icons | ||
return useStyleRegister( | ||
{ | ||
theme, | ||
token, | ||
hashId: '', | ||
path: ['ant-design-icons', iconPrefixCls], | ||
nonce: () => csp?.nonce!, | ||
}, | ||
() => [ | ||
{ | ||
[`.${iconPrefixCls}`]: { | ||
...resetIcon(), | ||
[`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { | ||
display: 'block', | ||
}, | ||
}, | ||
}, | ||
], | ||
); | ||
}; | ||
|
||
export default useStyle; | ||
// eslint-disable-next-line no-restricted-exports | ||
export { useResetIconStyle as default } from '../../theme/internal'; |
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,31 @@ | ||
import { useStyleRegister } from '@ant-design/cssinjs'; | ||
import { resetIcon } from '../../style'; | ||
import type { CSPConfig } from '../../config-provider'; | ||
import useToken from '../useToken'; | ||
|
||
const useResetIconStyle = (iconPrefixCls: string, csp?: CSPConfig) => { | ||
const [theme, token] = useToken(); | ||
|
||
// Generate style for icons | ||
return useStyleRegister( | ||
{ | ||
theme, | ||
token, | ||
hashId: '', | ||
path: ['ant-design-icons', iconPrefixCls], | ||
nonce: () => csp?.nonce!, | ||
}, | ||
() => [ | ||
{ | ||
[`.${iconPrefixCls}`]: { | ||
...resetIcon(), | ||
[`.${iconPrefixCls} .${iconPrefixCls}-icon`]: { | ||
display: 'block', | ||
}, | ||
}, | ||
}, | ||
], | ||
); | ||
}; | ||
|
||
export default useResetIconStyle; |