index.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _internal = require("../../theme/internal");
  7. const genBaseStyle = token => {
  8. const {
  9. componentCls,
  10. commentBg,
  11. commentPaddingBase,
  12. commentNestIndent,
  13. commentFontSizeBase,
  14. commentFontSizeSm,
  15. commentAuthorNameColor,
  16. commentAuthorTimeColor,
  17. commentActionColor,
  18. commentActionHoverColor,
  19. commentActionsMarginBottom,
  20. commentActionsMarginTop,
  21. commentContentDetailPMarginBottom
  22. } = token;
  23. return {
  24. [componentCls]: {
  25. position: 'relative',
  26. backgroundColor: commentBg,
  27. [`${componentCls}-inner`]: {
  28. display: 'flex',
  29. padding: commentPaddingBase
  30. },
  31. [`${componentCls}-avatar`]: {
  32. position: 'relative',
  33. flexShrink: 0,
  34. marginRight: token.marginSM,
  35. cursor: 'pointer',
  36. [`img`]: {
  37. width: '32px',
  38. height: '32px',
  39. borderRadius: '50%'
  40. }
  41. },
  42. [`${componentCls}-content`]: {
  43. position: 'relative',
  44. flex: `1 1 auto`,
  45. minWidth: `1px`,
  46. fontSize: commentFontSizeBase,
  47. wordWrap: 'break-word',
  48. [`&-author`]: {
  49. display: 'flex',
  50. flexWrap: 'wrap',
  51. justifyContent: 'flex-start',
  52. marginBottom: token.marginXXS,
  53. fontSize: commentFontSizeBase,
  54. [`& > a,& > span`]: {
  55. paddingRight: token.paddingXS,
  56. fontSize: commentFontSizeSm,
  57. lineHeight: `18px`
  58. },
  59. [`&-name`]: {
  60. color: commentAuthorNameColor,
  61. fontSize: commentFontSizeBase,
  62. transition: `color ${token.motionDurationSlow}`,
  63. [`> *`]: {
  64. color: commentAuthorNameColor,
  65. [`&:hover`]: {
  66. color: commentAuthorNameColor
  67. }
  68. }
  69. },
  70. [`&-time`]: {
  71. color: commentAuthorTimeColor,
  72. whiteSpace: 'nowrap',
  73. cursor: 'auto'
  74. }
  75. },
  76. [`&-detail p`]: {
  77. marginBottom: commentContentDetailPMarginBottom,
  78. whiteSpace: 'pre-wrap'
  79. }
  80. },
  81. [`${componentCls}-actions`]: {
  82. marginTop: commentActionsMarginTop,
  83. marginBottom: commentActionsMarginBottom,
  84. paddingLeft: 0,
  85. [`> li`]: {
  86. display: 'inline-block',
  87. color: commentActionColor,
  88. [`> span`]: {
  89. marginRight: '10px',
  90. color: commentActionColor,
  91. fontSize: commentFontSizeSm,
  92. cursor: 'pointer',
  93. transition: `color ${token.motionDurationSlow}`,
  94. userSelect: 'none',
  95. [`&:hover`]: {
  96. color: commentActionHoverColor
  97. }
  98. }
  99. }
  100. },
  101. [`${componentCls}-nested`]: {
  102. marginLeft: commentNestIndent
  103. },
  104. '&-rtl': {
  105. direction: 'rtl'
  106. }
  107. }
  108. };
  109. };
  110. var _default = exports.default = (0, _internal.genComponentStyleHook)('Comment', token => {
  111. const commentToken = (0, _internal.mergeToken)(token, {
  112. commentBg: 'inherit',
  113. commentPaddingBase: `${token.paddingMD}px 0`,
  114. commentNestIndent: `44px`,
  115. commentFontSizeBase: token.fontSize,
  116. commentFontSizeSm: token.fontSizeSM,
  117. commentAuthorNameColor: token.colorTextTertiary,
  118. commentAuthorTimeColor: token.colorTextPlaceholder,
  119. commentActionColor: token.colorTextTertiary,
  120. commentActionHoverColor: token.colorTextSecondary,
  121. commentActionsMarginBottom: 'inherit',
  122. commentActionsMarginTop: token.marginSM,
  123. commentContentDetailPMarginBottom: 'inherit'
  124. });
  125. return [genBaseStyle(commentToken)];
  126. });