import {JSX, mergeProps, splitProps} from "solid-js"; import classNames from "./classnames"; import Anchor from "./Anchor"; import {useBootstrapPrefix} from "./ThemeProvider"; import {BsPrefixProps, BsPrefixRefForwardingComponent, ElementType} from "./helpers"; import {Dynamic} from "solid-js/web"; export interface BreadcrumbItemProps extends BsPrefixProps, Omit, "title"> { active?: boolean; href?: string; linkAs?: ElementType; target?: string; title?: string; linkProps?: Record; // the generic is to much work here } const defaultProps = { as: "li", active: false, linkAs: Anchor, linkProps: {}, }; const BreadcrumbItem: BsPrefixRefForwardingComponent<"li", BreadcrumbItemProps> = ( p: BreadcrumbItemProps, ) => { const [local, props] = splitProps(mergeProps(defaultProps, p), [ "bsPrefix", "active", "children", "class", "as", "linkAs", "linkProps", "href", "title", "target", ]); const prefix = useBootstrapPrefix(local.bsPrefix, "breadcrumb-item"); return ( {local.active ? ( local.children ) : ( {local.children} )} ); }; export default BreadcrumbItem;