mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
* refactor: uninstall classnames & install clsx * refactor: uninstall classnames & install clsx * test: rename test fn * test: update snap * update * update * update * update * update snap * update * update --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: thinkasany <480968828@qq.com>
32 lines
952 B
TypeScript
32 lines
952 B
TypeScript
import * as React from 'react';
|
|
import { clsx } from 'clsx';
|
|
|
|
import { ConfigContext } from '../config-provider';
|
|
import BreadcrumbContext from './BreadcrumbContext';
|
|
|
|
type CompoundedComponent = React.FC<React.PropsWithChildren> & {
|
|
/** @internal */
|
|
__ANT_BREADCRUMB_SEPARATOR: boolean;
|
|
};
|
|
|
|
const BreadcrumbSeparator: CompoundedComponent = ({ children }) => {
|
|
const { getPrefixCls } = React.useContext(ConfigContext);
|
|
const prefixCls = getPrefixCls('breadcrumb');
|
|
const breadcrumbContext = React.useContext(BreadcrumbContext);
|
|
const { classNames: mergedClassNames, styles: mergedStyles } = breadcrumbContext;
|
|
|
|
return (
|
|
<li
|
|
className={clsx(`${prefixCls}-separator`, mergedClassNames?.separator)}
|
|
style={mergedStyles?.separator}
|
|
aria-hidden="true"
|
|
>
|
|
{children === '' ? children : children || '/'}
|
|
</li>
|
|
);
|
|
};
|
|
|
|
BreadcrumbSeparator.__ANT_BREADCRUMB_SEPARATOR = true;
|
|
|
|
export default BreadcrumbSeparator;
|