ant-design/components/breadcrumb/BreadcrumbSeparator.tsx

18 lines
550 B
TypeScript
Raw Normal View History

2019-07-25 12:02:15 +08:00
import * as React from 'react';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
2019-07-31 10:47:34 +08:00
export default class BreadcrumbSeparator extends React.Component<any> {
static __ANT_BREADCRUMB_SEPARATOR = true;
2019-07-25 12:02:15 +08:00
renderSeparator = ({ getPrefixCls }: ConfigConsumerProps) => {
2019-07-31 10:47:34 +08:00
const { children } = this.props;
2019-07-25 12:02:15 +08:00
const prefixCls = getPrefixCls('breadcrumb');
2019-07-31 10:47:34 +08:00
return <span className={`${prefixCls}-separator`}>{children || '/'}</span>;
2019-07-25 12:02:15 +08:00
};
render() {
return <ConfigConsumer>{this.renderSeparator}</ConfigConsumer>;
}
}