2022-05-24 01:13:36 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2023-05-18 16:32:52 +08:00
|
|
|
import { genFocusStyle, resetComponent } from '../../style';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
2019-05-06 12:04:39 +08:00
|
|
|
|
2023-05-18 16:32:52 +08:00
|
|
|
export interface ComponentToken {
|
|
|
|
itemColor: string;
|
|
|
|
iconFontSize: number;
|
|
|
|
linkColor: string;
|
|
|
|
linkHoverColor: string;
|
|
|
|
lastItemColor: string;
|
|
|
|
separatorMargin: number;
|
|
|
|
separatorColor: string;
|
2022-05-24 01:13:36 +08:00
|
|
|
}
|
|
|
|
|
2023-05-18 16:32:52 +08:00
|
|
|
interface BreadcrumbToken extends FullToken<'Breadcrumb'> {}
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = (token) => {
|
2022-05-24 01:13:36 +08:00
|
|
|
const { componentCls, iconCls } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[componentCls]: {
|
|
|
|
...resetComponent(token),
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.itemColor,
|
|
|
|
fontSize: token.fontSize,
|
2022-05-24 01:13:36 +08:00
|
|
|
|
|
|
|
[iconCls]: {
|
2023-05-18 16:32:52 +08:00
|
|
|
fontSize: token.iconFontSize,
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
ol: {
|
|
|
|
display: 'flex',
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
|
|
|
listStyle: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
a: {
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.linkColor,
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `color ${token.motionDurationMid}`,
|
2022-09-07 12:00:00 +08:00
|
|
|
padding: `0 ${token.paddingXXS}px`,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadiusSM,
|
2022-09-07 12:00:00 +08:00
|
|
|
height: token.lineHeight * token.fontSize,
|
|
|
|
display: 'inline-block',
|
|
|
|
marginInline: -token.marginXXS,
|
2022-05-24 01:13:36 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.linkHoverColor,
|
2022-09-07 12:00:00 +08:00
|
|
|
backgroundColor: token.colorBgTextHover,
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
2022-09-09 10:53:03 +08:00
|
|
|
|
|
|
|
...genFocusStyle(token),
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
|
2023-01-10 19:13:42 +08:00
|
|
|
[`li:last-child`]: {
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.lastItemColor,
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-separator`]: {
|
2023-05-18 16:32:52 +08:00
|
|
|
marginInline: token.separatorMargin,
|
|
|
|
color: token.separatorColor,
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${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-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadiusSM,
|
2022-09-07 12:00:00 +08:00
|
|
|
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': {
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.linkHoverColor,
|
2022-09-07 12:00:00 +08:00
|
|
|
backgroundColor: token.colorBgTextHover,
|
|
|
|
|
|
|
|
a: {
|
2023-05-18 16:32:52 +08:00
|
|
|
color: token.linkHoverColor,
|
2022-09-07 12:00:00 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
a: {
|
|
|
|
'&:hover': {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
2022-05-24 01:13:36 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// rtl style
|
|
|
|
[`&${token.componentCls}-rtl`]: {
|
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2023-05-18 16:32:52 +08:00
|
|
|
export default genComponentStyleHook(
|
|
|
|
'Breadcrumb',
|
|
|
|
(token) => {
|
|
|
|
const BreadcrumbToken = mergeToken<BreadcrumbToken>(token, {});
|
|
|
|
return [genBreadcrumbStyle(BreadcrumbToken)];
|
|
|
|
},
|
|
|
|
(token) => ({
|
|
|
|
itemColor: token.colorTextDescription,
|
|
|
|
lastItemColor: token.colorText,
|
|
|
|
iconFontSize: token.fontSize,
|
|
|
|
linkColor: token.colorTextDescription,
|
|
|
|
linkHoverColor: token.colorText,
|
|
|
|
separatorColor: token.colorTextDescription,
|
|
|
|
separatorMargin: token.marginXS,
|
|
|
|
}),
|
|
|
|
);
|