@quanxi/ui
Version:
全悉组件库
44 lines (43 loc) • 1.46 kB
TypeScript
import React from "react";
import BreadcrumbItem from "./BreadcrumbItem";
import BreadcrumbSeparator from "./BreadcrumbSeparator";
import "./style.scss";
export interface BreadcrumbItemType {
key?: React.Key;
/**
* Different with `path`. Directly set the link of this item.
*/
href?: string;
/**
* Different with `href`. It will concat all prev `path` to the current one.
*/
path?: string;
query?: Record<string, string>;
title: React.ReactNode;
className?: string;
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLSpanElement>;
}
export interface BreadcrumbSeparatorType {
type: "separator";
separator?: React.ReactNode;
}
export type ItemType = BreadcrumbItemType | BreadcrumbSeparatorType;
export interface BaseBreadcrumbProps {
params?: any;
separator?: React.ReactNode;
style?: React.CSSProperties;
className?: string;
rootClassName?: string;
bcType?: "default" | "compact";
}
export interface NewBreadcrumbProps extends BaseBreadcrumbProps {
items: ItemType[];
itemRender?: (route: ItemType, params: any, routes: ItemType[], paths: string[]) => React.ReactNode;
}
export type BreadcrumbProps = BaseBreadcrumbProps | NewBreadcrumbProps;
type CompoundedComponent = React.FC<BreadcrumbProps> & {
Item: typeof BreadcrumbItem;
Separator: typeof BreadcrumbSeparator;
};
declare const Breadcrumb: CompoundedComponent;
export default Breadcrumb;