mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
refactor(Breadcrumb): restructure Breadcrumb component to use compounded components for Item and Separator (#55892)
This commit is contained in:
@@ -13,7 +13,7 @@ import type { DropdownProps } from '../dropdown';
|
||||
import type { BreadcrumbContextProps } from './BreadcrumbContext';
|
||||
import BreadcrumbContext from './BreadcrumbContext';
|
||||
import type { BreadcrumbItemProps } from './BreadcrumbItem';
|
||||
import BreadcrumbItem, { InternalBreadcrumbItem } from './BreadcrumbItem';
|
||||
import { InternalBreadcrumbItem } from './BreadcrumbItem';
|
||||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||
import useStyle from './style';
|
||||
import useItemRender from './useItemRender';
|
||||
@@ -295,9 +295,6 @@ const Breadcrumb = <T extends AnyObject = AnyObject>(props: BreadcrumbProps<T>)
|
||||
);
|
||||
};
|
||||
|
||||
Breadcrumb.Item = BreadcrumbItem;
|
||||
Breadcrumb.Separator = BreadcrumbSeparator;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
Breadcrumb.displayName = 'Breadcrumb';
|
||||
}
|
||||
|
||||
@@ -1,6 +1,18 @@
|
||||
import Breadcrumb from './Breadcrumb';
|
||||
import InternalBreadcrumb from './Breadcrumb';
|
||||
import BreadcrumbItem from './BreadcrumbItem';
|
||||
import BreadcrumbSeparator from './BreadcrumbSeparator';
|
||||
|
||||
export type { BreadcrumbProps } from './Breadcrumb';
|
||||
export type { BreadcrumbItemProps, SeparatorType } from './BreadcrumbItem';
|
||||
|
||||
type CompoundedComponent = typeof InternalBreadcrumb & {
|
||||
Item: typeof BreadcrumbItem;
|
||||
Separator: typeof BreadcrumbSeparator;
|
||||
};
|
||||
|
||||
const Breadcrumb = InternalBreadcrumb as CompoundedComponent;
|
||||
|
||||
Breadcrumb.Item = BreadcrumbItem;
|
||||
Breadcrumb.Separator = BreadcrumbSeparator;
|
||||
|
||||
export default Breadcrumb;
|
||||
|
||||
Reference in New Issue
Block a user