inline.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { unit } from '@ant-design/cssinjs';
  2. const genStepsInlineStyle = token => {
  3. const {
  4. componentCls,
  5. inlineDotSize,
  6. inlineTitleColor,
  7. inlineTailColor
  8. } = token;
  9. const containerPaddingTop = token.calc(token.paddingXS).add(token.lineWidth).equal();
  10. const titleStyle = {
  11. [`${componentCls}-item-container ${componentCls}-item-content ${componentCls}-item-title`]: {
  12. color: inlineTitleColor
  13. }
  14. };
  15. return {
  16. [`&${componentCls}-inline`]: {
  17. width: 'auto',
  18. display: 'inline-flex',
  19. [`${componentCls}-item`]: {
  20. flex: 'none',
  21. '&-container': {
  22. padding: `${unit(containerPaddingTop)} ${unit(token.paddingXXS)} 0`,
  23. margin: `0 ${unit(token.calc(token.marginXXS).div(2).equal())}`,
  24. borderRadius: token.borderRadiusSM,
  25. cursor: 'pointer',
  26. transition: `background-color ${token.motionDurationMid}`,
  27. '&:hover': {
  28. background: token.controlItemBgHover
  29. },
  30. "&[role='button']:hover": {
  31. opacity: 1
  32. }
  33. },
  34. '&-icon': {
  35. width: inlineDotSize,
  36. height: inlineDotSize,
  37. marginInlineStart: `calc(50% - ${unit(token.calc(inlineDotSize).div(2).equal())})`,
  38. [`> ${componentCls}-icon`]: {
  39. top: 0
  40. },
  41. [`${componentCls}-icon-dot`]: {
  42. borderRadius: token.calc(token.fontSizeSM).div(4).equal(),
  43. '&::after': {
  44. display: 'none'
  45. }
  46. }
  47. },
  48. '&-content': {
  49. width: 'auto',
  50. marginTop: token.calc(token.marginXS).sub(token.lineWidth).equal()
  51. },
  52. '&-title': {
  53. color: inlineTitleColor,
  54. fontSize: token.fontSizeSM,
  55. lineHeight: token.lineHeightSM,
  56. fontWeight: 'normal',
  57. marginBottom: token.calc(token.marginXXS).div(2).equal()
  58. },
  59. '&-description': {
  60. display: 'none'
  61. },
  62. '&-tail': {
  63. marginInlineStart: 0,
  64. top: token.calc(inlineDotSize).div(2).add(containerPaddingTop).equal(),
  65. transform: `translateY(-50%)`,
  66. '&:after': {
  67. width: '100%',
  68. height: token.lineWidth,
  69. borderRadius: 0,
  70. marginInlineStart: 0,
  71. background: inlineTailColor
  72. }
  73. },
  74. [`&:first-child ${componentCls}-item-tail`]: {
  75. width: '50%',
  76. marginInlineStart: '50%'
  77. },
  78. [`&:last-child ${componentCls}-item-tail`]: {
  79. display: 'block',
  80. width: '50%'
  81. },
  82. '&-wait': Object.assign({
  83. [`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
  84. backgroundColor: token.colorBorderBg,
  85. border: `${unit(token.lineWidth)} ${token.lineType} ${inlineTailColor}`
  86. }
  87. }, titleStyle),
  88. '&-finish': Object.assign({
  89. [`${componentCls}-item-tail::after`]: {
  90. backgroundColor: inlineTailColor
  91. },
  92. [`${componentCls}-item-icon ${componentCls}-icon ${componentCls}-icon-dot`]: {
  93. backgroundColor: inlineTailColor,
  94. border: `${unit(token.lineWidth)} ${token.lineType} ${inlineTailColor}`
  95. }
  96. }, titleStyle),
  97. '&-error': titleStyle,
  98. '&-active, &-process': Object.assign({
  99. [`${componentCls}-item-icon`]: {
  100. width: inlineDotSize,
  101. height: inlineDotSize,
  102. marginInlineStart: `calc(50% - ${unit(token.calc(inlineDotSize).div(2).equal())})`,
  103. top: 0
  104. }
  105. }, titleStyle),
  106. [`&:not(${componentCls}-item-active) > ${componentCls}-item-container[role='button']:hover`]: {
  107. [`${componentCls}-item-title`]: {
  108. color: inlineTitleColor
  109. }
  110. }
  111. }
  112. }
  113. };
  114. };
  115. export default genStepsInlineStyle;