ant-design/components/steps/style/progress.ts
cc heart 3871763950
refactor: steps support css var (#45878)
* feat: steps support cssVars

* fix: fix style

* Update check-cssinjs.tsx

* fix: fix bug

* style: code format

* fix: fix bug

* refactor: wireframe & tailTop

* wip: fix taiTop

* fix: remove tailTop and use token calc top

fix: remove tailTop and use token calc top

perf: add annotation

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: lijianan <574980606@qq.com>
2023-11-17 15:33:28 +08:00

87 lines
2.5 KiB
TypeScript

import type { CSSObject } from '@ant-design/cssinjs';
import type { StepsToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
const genStepsProgressStyle: GenerateStyle<StepsToken, CSSObject> = (token) => {
const { antCls, componentCls } = token;
return {
[`&${componentCls}-with-progress`]: {
[`${componentCls}-item`]: {
paddingTop: token.paddingXXS,
[`&-process ${componentCls}-item-container ${componentCls}-item-icon ${componentCls}-icon`]:
{
color: token.processIconColor,
},
},
[`&${componentCls}-vertical > ${componentCls}-item `]: {
paddingInlineStart: token.paddingXXS,
[`> ${componentCls}-item-container > ${componentCls}-item-tail`]: {
top: token.marginXXS,
insetInlineStart: token
.calc(token.iconSize)
.div(2)
.sub(token.lineWidth)
.add(token.paddingXXS)
.equal(),
},
},
[`&, &${componentCls}-small`]: {
[`&${componentCls}-horizontal ${componentCls}-item:first-child`]: {
paddingBottom: token.paddingXXS,
paddingInlineStart: token.paddingXXS,
},
},
[`&${componentCls}-small${componentCls}-vertical > ${componentCls}-item > ${componentCls}-item-container > ${componentCls}-item-tail`]:
{
insetInlineStart: token
.calc(token.iconSizeSM)
.div(2)
.sub(token.lineWidth)
.add(token.paddingXXS)
.equal(),
},
[`&${componentCls}-label-vertical`]: {
[`${componentCls}-item ${componentCls}-item-tail`]: {
top: token.calc(token.margin).sub(token.calc(token.lineWidth).mul(2).equal()).equal(),
},
},
[`${componentCls}-item-icon`]: {
position: 'relative',
[`${antCls}-progress`]: {
position: 'absolute',
insetBlockStart: token
.calc(
token
.calc(token.iconSize)
.sub(token.stepsProgressSize)
.sub(token.calc(token.lineWidth).mul(2).equal())
.equal(),
)
.div(2)
.equal(),
insetInlineStart: token
.calc(
token
.calc(token.iconSize)
.sub(token.stepsProgressSize)
.sub(token.calc(token.lineWidth).mul(2).equal())
.equal(),
)
.div(2)
.equal(),
},
},
},
};
};
export default genStepsProgressStyle;