mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-18 11:18:14 +08:00
feat: preserve breakpoint tokens value (#45981)
This commit is contained in:
parent
1f61c28bb1
commit
682904a9ec
@ -106,7 +106,7 @@ const genBorderedStyle = (token: ListToken): CSSObject => {
|
||||
const genResponsiveStyle = (token: ListToken): CSSObject => {
|
||||
const { componentCls, screenSM, screenMD, marginLG, marginSM, margin } = token;
|
||||
return {
|
||||
[`@media screen and (max-width:${screenMD})`]: {
|
||||
[`@media screen and (max-width:${screenMD}px)`]: {
|
||||
[`${componentCls}`]: {
|
||||
[`${componentCls}-item`]: {
|
||||
[`${componentCls}-item-action`]: {
|
||||
@ -124,7 +124,7 @@ const genResponsiveStyle = (token: ListToken): CSSObject => {
|
||||
},
|
||||
},
|
||||
|
||||
[`@media screen and (max-width: ${screenSM})`]: {
|
||||
[`@media screen and (max-width: ${screenSM}px)`]: {
|
||||
[`${componentCls}`]: {
|
||||
[`${componentCls}-item`]: {
|
||||
flexWrap: 'wrap',
|
||||
@ -299,10 +299,7 @@ const genBaseStyle: GenerateStyle<ListToken> = (token) => {
|
||||
insetBlockStart: '50%',
|
||||
insetInlineEnd: 0,
|
||||
width: lineWidth,
|
||||
height: token
|
||||
.calc(token.fontHeight)
|
||||
.sub(token.calc(token.marginXXS).mul(2))
|
||||
.equal(),
|
||||
height: token.calc(token.fontHeight).sub(token.calc(token.marginXXS).mul(2)).equal(),
|
||||
transform: 'translateY(-50%)',
|
||||
backgroundColor: token.colorSplit,
|
||||
},
|
||||
|
@ -174,7 +174,7 @@ const genModalStyle: GenerateStyle<ModalToken> = (token) => {
|
||||
},
|
||||
},
|
||||
|
||||
[`@media (max-width: ${token.screenSMMax})`]: {
|
||||
[`@media (max-width: ${token.screenSMMax}px)`]: {
|
||||
[componentCls]: {
|
||||
maxWidth: 'calc(100vw - 16px)',
|
||||
margin: `${unit(token.marginXS)} auto`,
|
||||
|
@ -44,6 +44,28 @@ export const ignore: {
|
||||
motionUnit: true,
|
||||
};
|
||||
|
||||
const preserve: {
|
||||
[key in keyof AliasToken]?: boolean;
|
||||
} = {
|
||||
screenXS: true,
|
||||
screenXSMin: true,
|
||||
screenXSMax: true,
|
||||
screenSM: true,
|
||||
screenSMMin: true,
|
||||
screenSMMax: true,
|
||||
screenMD: true,
|
||||
screenMDMin: true,
|
||||
screenMDMax: true,
|
||||
screenLG: true,
|
||||
screenLGMin: true,
|
||||
screenLGMax: true,
|
||||
screenXL: true,
|
||||
screenXLMin: true,
|
||||
screenXLMax: true,
|
||||
screenXXL: true,
|
||||
screenXXLMin: true,
|
||||
};
|
||||
|
||||
export const getComputedToken = (
|
||||
originToken: SeedToken,
|
||||
overrideToken: DesignTokenProviderProps['components'] & {
|
||||
@ -122,6 +144,7 @@ export default function useToken(): [
|
||||
key: cssVar.key,
|
||||
unitless,
|
||||
ignore,
|
||||
preserve,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
@ -113,7 +113,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@ant-design/colors": "^7.0.0",
|
||||
"@ant-design/cssinjs": "^1.18.0-alpha.1",
|
||||
"@ant-design/cssinjs": "^1.18.0-alpha.2",
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@ant-design/react-slick": "~1.0.2",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
|
Loading…
Reference in New Issue
Block a user