forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pagination support cssVar (ant-design#45800)
* feat: pagination support cssVar * feat: optimize code * Update check-cssinjs.tsx Signed-off-by: lijianan <[email protected]> * feat: pagination css var * chore: code clean * chore: update snapshot --------- Signed-off-by: lijianan <[email protected]> Co-authored-by: lijianan <[email protected]> Co-authored-by: MadCcc <[email protected]>
- Loading branch information
1 parent
682904a
commit f67abe4
Showing
7 changed files
with
210 additions
and
176 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
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,111 @@ | ||
import { genSubStyleComponent } from '../../theme/util/genComponentStyleHook'; | ||
import type { PaginationToken } from '.'; | ||
import { prepareComponentToken, prepareToken } from '.'; | ||
import type { GenerateStyle } from '../../theme/interface'; | ||
import { unit } from '@ant-design/cssinjs'; | ||
|
||
const genBorderedStyle: GenerateStyle<PaginationToken> = (token) => { | ||
const { componentCls } = token; | ||
|
||
return { | ||
[`${componentCls}${componentCls}-bordered${componentCls}-disabled:not(${componentCls}-mini)`]: { | ||
'&, &:hover': { | ||
[`${componentCls}-item-link`]: { | ||
borderColor: token.colorBorder, | ||
}, | ||
}, | ||
|
||
'&:focus-visible': { | ||
[`${componentCls}-item-link`]: { | ||
borderColor: token.colorBorder, | ||
}, | ||
}, | ||
|
||
[`${componentCls}-item, ${componentCls}-item-link`]: { | ||
backgroundColor: token.colorBgContainerDisabled, | ||
borderColor: token.colorBorder, | ||
|
||
[`&:hover:not(${componentCls}-item-active)`]: { | ||
backgroundColor: token.colorBgContainerDisabled, | ||
borderColor: token.colorBorder, | ||
|
||
a: { | ||
color: token.colorTextDisabled, | ||
}, | ||
}, | ||
|
||
[`&${componentCls}-item-active`]: { | ||
backgroundColor: token.itemActiveBgDisabled, | ||
}, | ||
}, | ||
|
||
[`${componentCls}-prev, ${componentCls}-next`]: { | ||
'&:hover button': { | ||
backgroundColor: token.colorBgContainerDisabled, | ||
borderColor: token.colorBorder, | ||
color: token.colorTextDisabled, | ||
}, | ||
|
||
[`${componentCls}-item-link`]: { | ||
backgroundColor: token.colorBgContainerDisabled, | ||
borderColor: token.colorBorder, | ||
}, | ||
}, | ||
}, | ||
|
||
[`${componentCls}${componentCls}-bordered:not(${componentCls}-mini)`]: { | ||
[`${componentCls}-prev, ${componentCls}-next`]: { | ||
'&:hover button': { | ||
borderColor: token.colorPrimaryHover, | ||
backgroundColor: token.itemBg, | ||
}, | ||
|
||
[`${componentCls}-item-link`]: { | ||
backgroundColor: token.itemLinkBg, | ||
borderColor: token.colorBorder, | ||
}, | ||
|
||
[`&:hover ${componentCls}-item-link`]: { | ||
borderColor: token.colorPrimary, | ||
backgroundColor: token.itemBg, | ||
color: token.colorPrimary, | ||
}, | ||
|
||
[`&${componentCls}-disabled`]: { | ||
[`${componentCls}-item-link`]: { | ||
borderColor: token.colorBorder, | ||
color: token.colorTextDisabled, | ||
}, | ||
}, | ||
}, | ||
|
||
[`${componentCls}-item`]: { | ||
backgroundColor: token.itemBg, | ||
border: `${unit(token.lineWidth)} ${token.lineType} ${token.colorBorder}`, | ||
|
||
[`&:hover:not(${componentCls}-item-active)`]: { | ||
borderColor: token.colorPrimary, | ||
backgroundColor: token.itemBg, | ||
|
||
a: { | ||
color: token.colorPrimary, | ||
}, | ||
}, | ||
|
||
'&-active': { | ||
borderColor: token.colorPrimary, | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
export default genSubStyleComponent( | ||
['Pagination', 'bordered'], | ||
(token) => { | ||
const paginationToken = prepareToken(token); | ||
|
||
return [genBorderedStyle(paginationToken)]; | ||
}, | ||
prepareComponentToken, | ||
); |
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,4 @@ | ||
import { genCSSVarRegister } from '../../theme/internal'; | ||
import { prepareComponentToken } from '.'; | ||
|
||
export default genCSSVarRegister('Pagination', prepareComponentToken); |
Oops, something went wrong.