mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 22:48:29 +08:00
85086f14b6
Related issue: #4655
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { PropTypes } from 'react';
|
|
|
|
export interface BreadcrumbItemProps {
|
|
prefixCls?: string;
|
|
separator?: React.ReactNode;
|
|
href?: string;
|
|
}
|
|
|
|
export default class BreadcrumbItem extends React.Component<BreadcrumbItemProps, any> {
|
|
static __ANT_BREADCRUMB_ITEM = true;
|
|
|
|
static defaultProps = {
|
|
prefixCls: 'ant-breadcrumb',
|
|
separator: '/',
|
|
};
|
|
|
|
static propTypes = {
|
|
prefixCls: PropTypes.string,
|
|
separator: PropTypes.oneOfType([
|
|
PropTypes.string,
|
|
PropTypes.element,
|
|
]),
|
|
href: PropTypes.string,
|
|
};
|
|
|
|
render() {
|
|
const { prefixCls, separator, children, ...restProps } = this.props;
|
|
let link;
|
|
if ('href' in this.props) {
|
|
link = <a className={`${prefixCls}-link`} {...restProps}>{children}</a>;
|
|
} else {
|
|
link = <span className={`${prefixCls}-link`} {...restProps}>{children}</span>;
|
|
}
|
|
return (
|
|
<span>
|
|
{link}
|
|
<span className={`${prefixCls}-separator`}>{separator}</span>
|
|
</span>
|
|
);
|
|
}
|
|
}
|