index.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import { genComponentStyleHook, mergeToken } from '../../theme/internal';
  3. import { genFocusStyle, resetComponent } from '../../style';
  4. const genBreadcrumbStyle = token => {
  5. const {
  6. componentCls,
  7. iconCls
  8. } = token;
  9. return {
  10. [componentCls]: _extends(_extends({}, resetComponent(token)), {
  11. color: token.breadcrumbBaseColor,
  12. fontSize: token.breadcrumbFontSize,
  13. [iconCls]: {
  14. fontSize: token.breadcrumbIconFontSize
  15. },
  16. ol: {
  17. display: 'flex',
  18. flexWrap: 'wrap',
  19. margin: 0,
  20. padding: 0,
  21. listStyle: 'none'
  22. },
  23. a: _extends({
  24. color: token.breadcrumbLinkColor,
  25. transition: `color ${token.motionDurationMid}`,
  26. padding: `0 ${token.paddingXXS}px`,
  27. borderRadius: token.borderRadiusSM,
  28. height: token.lineHeight * token.fontSize,
  29. display: 'inline-block',
  30. marginInline: -token.marginXXS,
  31. '&:hover': {
  32. color: token.breadcrumbLinkColorHover,
  33. backgroundColor: token.colorBgTextHover
  34. }
  35. }, genFocusStyle(token)),
  36. [`li:last-child`]: {
  37. color: token.breadcrumbLastItemColor,
  38. [`& > ${componentCls}-separator`]: {
  39. display: 'none'
  40. }
  41. },
  42. [`${componentCls}-separator`]: {
  43. marginInline: token.breadcrumbSeparatorMargin,
  44. color: token.breadcrumbSeparatorColor
  45. },
  46. [`${componentCls}-link`]: {
  47. [`
  48. > ${iconCls} + span,
  49. > ${iconCls} + a
  50. `]: {
  51. marginInlineStart: token.marginXXS
  52. }
  53. },
  54. [`${componentCls}-overlay-link`]: {
  55. borderRadius: token.borderRadiusSM,
  56. height: token.lineHeight * token.fontSize,
  57. display: 'inline-block',
  58. padding: `0 ${token.paddingXXS}px`,
  59. marginInline: -token.marginXXS,
  60. [`> ${iconCls}`]: {
  61. marginInlineStart: token.marginXXS,
  62. fontSize: token.fontSizeIcon
  63. },
  64. '&:hover': {
  65. color: token.breadcrumbLinkColorHover,
  66. backgroundColor: token.colorBgTextHover,
  67. a: {
  68. color: token.breadcrumbLinkColorHover
  69. }
  70. },
  71. a: {
  72. '&:hover': {
  73. backgroundColor: 'transparent'
  74. }
  75. }
  76. },
  77. // rtl style
  78. [`&${token.componentCls}-rtl`]: {
  79. direction: 'rtl'
  80. }
  81. })
  82. };
  83. };
  84. // ============================== Export ==============================
  85. export default genComponentStyleHook('Breadcrumb', token => {
  86. const BreadcrumbToken = mergeToken(token, {
  87. breadcrumbBaseColor: token.colorTextDescription,
  88. breadcrumbFontSize: token.fontSize,
  89. breadcrumbIconFontSize: token.fontSize,
  90. breadcrumbLinkColor: token.colorTextDescription,
  91. breadcrumbLinkColorHover: token.colorText,
  92. breadcrumbLastItemColor: token.colorText,
  93. breadcrumbSeparatorMargin: token.marginXS,
  94. breadcrumbSeparatorColor: token.colorTextDescription
  95. });
  96. return [genBreadcrumbStyle(BreadcrumbToken)];
  97. });