2022-05-24 01:13:36 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme';
|
2022-07-11 15:35:58 +08:00
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme';
|
|
|
|
import { resetComponent } from '../../style';
|
2019-05-06 12:04:39 +08:00
|
|
|
|
2022-05-24 01:13:36 +08:00
|
|
|
interface BreadcrumbToken extends FullToken<'Breadcrumb'> {
|
|
|
|
breadcrumbBaseColor: string;
|
|
|
|
breadcrumbFontSize: number;
|
|
|
|
breadcrumbIconFontSize: number;
|
|
|
|
breadcrumbLinkColor: string;
|
|
|
|
breadcrumbLinkColorHover: string;
|
|
|
|
breadcrumbLastItemColor: string;
|
|
|
|
breadcrumbSeparatorMargin: number;
|
|
|
|
breadcrumbSeparatorColor: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = token => {
|
|
|
|
const { componentCls, iconCls } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[componentCls]: {
|
|
|
|
...resetComponent(token),
|
|
|
|
color: token.breadcrumbBaseColor,
|
|
|
|
fontSize: token.breadcrumbFontSize,
|
|
|
|
|
|
|
|
[iconCls]: {
|
|
|
|
fontSize: token.breadcrumbIconFontSize,
|
|
|
|
},
|
|
|
|
|
|
|
|
ol: {
|
|
|
|
display: 'flex',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
|
|
|
listStyle: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.breadcrumbLinkColor,
|
2022-09-07 14:08:14 +08:00
|
|
|
transition: `color ${token.motionDurationFast}`,
|
2022-09-07 12:00:00 +08:00
|
|
|
padding: `0 ${token.paddingXXS}px`,
|
|
|
|
borderRadius: token.radiusSM,
|
|
|
|
height: token.lineHeight * token.fontSize,
|
|
|
|
display: 'inline-block',
|
|
|
|
marginInline: -token.marginXXS,
|
2022-05-24 01:13:36 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
color: token.breadcrumbLinkColorHover,
|
2022-09-07 12:00:00 +08:00
|
|
|
backgroundColor: token.colorBgTextHover,
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-07-12 18:15:14 +08:00
|
|
|
[`li:last-child > ${componentCls}-separator`]: {
|
2022-05-24 01:13:36 +08:00
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-separator`]: {
|
|
|
|
marginInline: token.breadcrumbSeparatorMargin,
|
|
|
|
color: token.breadcrumbSeparatorColor,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-link`]: {
|
|
|
|
[`
|
2022-09-07 12:00:00 +08:00
|
|
|
> ${iconCls} + span,
|
|
|
|
> ${iconCls} + a
|
|
|
|
`]: {
|
2022-05-24 01:13:36 +08:00
|
|
|
marginInlineStart: token.marginXXS,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-overlay-link`]: {
|
2022-09-07 12:00:00 +08:00
|
|
|
borderRadius: token.radiusSM,
|
|
|
|
height: token.lineHeight * token.fontSize,
|
|
|
|
display: 'inline-block',
|
|
|
|
padding: `0 ${token.paddingXXS}px`,
|
|
|
|
marginInline: -token.marginXXS,
|
|
|
|
|
2022-05-24 01:13:36 +08:00
|
|
|
[`> ${iconCls}`]: {
|
|
|
|
marginInlineStart: token.marginXXS,
|
2022-09-07 12:00:00 +08:00
|
|
|
fontSize: token.fontSizeIcon,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
color: token.breadcrumbLinkColorHover,
|
|
|
|
backgroundColor: token.colorBgTextHover,
|
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.breadcrumbLinkColorHover,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
a: {
|
|
|
|
'&:hover': {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// rtl style
|
|
|
|
[`&${token.componentCls}-rtl`]: {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
|
|
|
export default genComponentStyleHook('Breadcrumb', token => {
|
|
|
|
const BreadcrumbToken = mergeToken<BreadcrumbToken>(token, {
|
2022-08-04 16:16:50 +08:00
|
|
|
breadcrumbBaseColor: token.colorTextDescription,
|
2022-05-24 01:13:36 +08:00
|
|
|
breadcrumbFontSize: token.fontSizeBase,
|
|
|
|
breadcrumbIconFontSize: token.fontSizeBase,
|
2022-08-04 16:16:50 +08:00
|
|
|
breadcrumbLinkColor: token.colorTextDescription,
|
2022-05-24 01:13:36 +08:00
|
|
|
breadcrumbLinkColorHover: token.colorText,
|
|
|
|
breadcrumbLastItemColor: token.colorText,
|
2022-09-07 12:00:00 +08:00
|
|
|
breadcrumbSeparatorMargin: token.marginXS,
|
2022-08-04 16:16:50 +08:00
|
|
|
breadcrumbSeparatorColor: token.colorTextDescription,
|
2022-05-24 01:13:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
return [genBreadcrumbStyle(BreadcrumbToken)];
|
|
|
|
});
|