You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.4 KiB
124 lines
3.4 KiB
3 years ago
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||
2 years ago
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
||
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||
2 years ago
|
import { genFocusStyle, resetComponent } from '../../style';
|
||
6 years ago
|
|
||
3 years ago
|
interface BreadcrumbToken extends FullToken<'Breadcrumb'> {
|
||
|
breadcrumbBaseColor: string;
|
||
|
breadcrumbFontSize: number;
|
||
|
breadcrumbIconFontSize: number;
|
||
|
breadcrumbLinkColor: string;
|
||
|
breadcrumbLinkColorHover: string;
|
||
|
breadcrumbLastItemColor: string;
|
||
|
breadcrumbSeparatorMargin: number;
|
||
|
breadcrumbSeparatorColor: string;
|
||
|
}
|
||
|
|
||
2 years ago
|
const genBreadcrumbStyle: GenerateStyle<BreadcrumbToken, CSSObject> = (token) => {
|
||
3 years ago
|
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,
|
||
2 years ago
|
transition: `color ${token.motionDurationMid}`,
|
||
2 years ago
|
padding: `0 ${token.paddingXXS}px`,
|
||
2 years ago
|
borderRadius: token.borderRadiusSM,
|
||
2 years ago
|
height: token.lineHeight * token.fontSize,
|
||
|
display: 'inline-block',
|
||
|
marginInline: -token.marginXXS,
|
||
3 years ago
|
|
||
|
'&:hover': {
|
||
|
color: token.breadcrumbLinkColorHover,
|
||
2 years ago
|
backgroundColor: token.colorBgTextHover,
|
||
3 years ago
|
},
|
||
2 years ago
|
|
||
|
...genFocusStyle(token),
|
||
3 years ago
|
},
|
||
|
|
||
2 years ago
|
[`li:last-child > ${componentCls}-separator`]: {
|
||
3 years ago
|
display: 'none',
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-separator`]: {
|
||
|
marginInline: token.breadcrumbSeparatorMargin,
|
||
|
color: token.breadcrumbSeparatorColor,
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-link`]: {
|
||
|
[`
|
||
2 years ago
|
> ${iconCls} + span,
|
||
|
> ${iconCls} + a
|
||
|
`]: {
|
||
3 years ago
|
marginInlineStart: token.marginXXS,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-overlay-link`]: {
|
||
2 years ago
|
borderRadius: token.borderRadiusSM,
|
||
2 years ago
|
height: token.lineHeight * token.fontSize,
|
||
|
display: 'inline-block',
|
||
|
padding: `0 ${token.paddingXXS}px`,
|
||
|
marginInline: -token.marginXXS,
|
||
|
|
||
3 years ago
|
[`> ${iconCls}`]: {
|
||
|
marginInlineStart: token.marginXXS,
|
||
2 years ago
|
fontSize: token.fontSizeIcon,
|
||
|
},
|
||
|
|
||
|
'&:hover': {
|
||
|
color: token.breadcrumbLinkColorHover,
|
||
|
backgroundColor: token.colorBgTextHover,
|
||
|
|
||
|
a: {
|
||
|
color: token.breadcrumbLinkColorHover,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
a: {
|
||
|
'&:hover': {
|
||
|
backgroundColor: 'transparent',
|
||
|
},
|
||
3 years ago
|
},
|
||
|
},
|
||
|
|
||
|
// rtl style
|
||
|
[`&${token.componentCls}-rtl`]: {
|
||
|
direction: 'rtl',
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
};
|
||
|
|
||
|
// ============================== Export ==============================
|
||
2 years ago
|
export default genComponentStyleHook('Breadcrumb', (token) => {
|
||
3 years ago
|
const BreadcrumbToken = mergeToken<BreadcrumbToken>(token, {
|
||
2 years ago
|
breadcrumbBaseColor: token.colorTextDescription,
|
||
2 years ago
|
breadcrumbFontSize: token.fontSize,
|
||
|
breadcrumbIconFontSize: token.fontSize,
|
||
2 years ago
|
breadcrumbLinkColor: token.colorTextDescription,
|
||
3 years ago
|
breadcrumbLinkColorHover: token.colorText,
|
||
|
breadcrumbLastItemColor: token.colorText,
|
||
2 years ago
|
breadcrumbSeparatorMargin: token.marginXS,
|
||
2 years ago
|
breadcrumbSeparatorColor: token.colorTextDescription,
|
||
3 years ago
|
});
|
||
|
|
||
|
return [genBreadcrumbStyle(BreadcrumbToken)];
|
||
|
});
|