mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
34 lines
840 B
React
34 lines
840 B
React
|
import React from 'react';
|
||
|
|
||
|
export default class BreadcrumbItem extends React.Component {
|
||
|
static defaultProps = {
|
||
|
prefixCls: 'ant-breadcrumb',
|
||
|
separator: '/',
|
||
|
}
|
||
|
|
||
|
static propTypes = {
|
||
|
prefixCls: React.PropTypes.string,
|
||
|
separator: React.PropTypes.oneOfType([
|
||
|
React.PropTypes.string,
|
||
|
React.PropTypes.element,
|
||
|
]),
|
||
|
href: React.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>
|
||
|
);
|
||
|
}
|
||
|
}
|