2022-11-08 15:57:28 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
|
|
import type { StepsToken } from '.';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-11-08 15:57:28 +08:00
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genStepsInlineStyle: GenerateStyle<StepsToken, CSSObject> = (token) => {
|
2022-11-08 15:57:28 +08:00
|
|
|
const { componentCls, inlineDotSize, inlineTitleColor, inlineTailColor } = token;
|
|
|
|
const containerPaddingTop = token.paddingXS + token.lineWidth;
|
|
|
|
const titleStyle = {
|
|
|
|
[`${componentCls}-item-container ${componentCls}-item-content ${componentCls}-item-title`]: {
|
|
|
|
color: inlineTitleColor,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`&${componentCls}-inline`]: {
|
|
|
|
width: 'auto',
|
|
|
|
display: 'inline-flex',
|
|
|
|
|
|
|
|
[`${componentCls}-item`]: {
|
|
|
|
flex: 'none',
|
|
|
|
|
|
|
|
'&-container': {
|
|
|
|
padding: `${containerPaddingTop}px ${token.paddingXXS}px 0`,
|
|
|
|
margin: `0 ${token.marginXXS / 2}px`,
|
|
|
|
borderRadius: token.borderRadiusSM,
|
|
|
|
cursor: 'pointer',
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `background-color ${token.motionDurationMid}`,
|
2022-11-08 15:57:28 +08:00
|
|
|
'&:hover': {
|
|
|
|
background: token.controlItemBgHover,
|
|
|
|
},
|
|
|
|
[`&[role='button']:hover`]: {
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-icon': {
|
|
|
|
width: inlineDotSize,
|
|
|
|
height: inlineDotSize,
|
|
|
|
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
|
|
|
|
[`> ${componentCls}-icon`]: {
|
|
|
|
top: 0,
|
|
|
|
},
|
|
|
|
[`${componentCls}-icon-dot`]: {
|
|
|
|
borderRadius: token.fontSizeSM / 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-content': {
|
|
|
|
width: 'auto',
|
|
|
|
marginTop: token.marginXS - token.lineWidth,
|
|
|
|
},
|
|
|
|
'&-title': {
|
|
|
|
color: inlineTitleColor,
|
|
|
|
fontSize: token.fontSizeSM,
|
|
|
|
lineHeight: token.lineHeightSM,
|
|
|
|
fontWeight: 'normal',
|
|
|
|
marginBottom: token.marginXXS / 2,
|
|
|
|
},
|
|
|
|
'&-description': {
|
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-tail': {
|
|
|
|
marginInlineStart: 0,
|
|
|
|
top: containerPaddingTop + inlineDotSize / 2,
|
|
|
|
transform: `translateY(-50%)`,
|
|
|
|
'&:after': {
|
|
|
|
width: '100%',
|
|
|
|
height: token.lineWidth,
|
|
|
|
borderRadius: 0,
|
|
|
|
marginInlineStart: 0,
|
|
|
|
background: inlineTailColor,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:first-child ${componentCls}-item-tail`]: {
|
|
|
|
width: '50%',
|
|
|
|
marginInlineStart: '50%',
|
|
|
|
},
|
|
|
|
[`&:last-child ${componentCls}-item-tail`]: {
|
|
|
|
display: 'block',
|
|
|
|
width: '50%',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-wait': {
|
|
|
|
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
|
|
|
|
backgroundColor: token.colorBorderBg,
|
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`,
|
|
|
|
},
|
|
|
|
...titleStyle,
|
|
|
|
},
|
|
|
|
'&-finish': {
|
|
|
|
[`${componentCls}-item-tail::after`]: {
|
|
|
|
backgroundColor: inlineTailColor,
|
|
|
|
},
|
|
|
|
[`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
|
|
|
|
backgroundColor: inlineTailColor,
|
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${inlineTailColor}`,
|
|
|
|
},
|
|
|
|
...titleStyle,
|
|
|
|
},
|
|
|
|
'&-error': titleStyle,
|
|
|
|
'&-active, &-process': {
|
|
|
|
[`${componentCls}-item-icon`]: {
|
|
|
|
width: inlineDotSize,
|
|
|
|
height: inlineDotSize,
|
|
|
|
marginInlineStart: `calc(50% - ${inlineDotSize / 2}px)`,
|
|
|
|
top: 0,
|
|
|
|
},
|
|
|
|
...titleStyle,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:not(${componentCls}-item-active) > ${componentCls}-item-container[role='button']:hover`]:
|
|
|
|
{
|
|
|
|
[`${componentCls}-item-title`]: {
|
|
|
|
color: inlineTitleColor,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genStepsInlineStyle;
|