import { type ComponentProps, type JSXElement, type ValidComponent, children, createMemo, For, mergeProps, splitProps, } from "solid-js"; import { Dynamic } from "solid-js/web"; import { type Prettify, } from "@/components/types/Prettify"; import { type WithExtendedComponentProps } from "@/components/types/ExtendedComponentProps"; import { useThemeContext, } from "@/components/ThemeProvider/"; import cn from "@/components/utils/cn"; import breadcrumbsDefaultStyle from "./style"; type BreadcrumbsSlotProps = Prettify<{ ol?: Prettify & WithExtendedComponentProps>, li?: Prettify & WithExtendedComponentProps>, seperator?: Prettify & WithExtendedComponentProps>; }>; export type BreadcrumbsProps = { as?: T; class?: string; seperator?: JSXElement; slotProps?: BreadcrumbsSlotProps; } & ComponentProps; const Breadcrumbs = ( props: BreadcrumbsProps, ) => { const merged = mergeProps({ seperator: "/" as const, }, props); const [local, rest] = splitProps(merged, [ "as", "children", "class", "seperator", "slotProps", ]); const themeContextValue = useThemeContext(); const resolved = children(() => local.children); const items = resolved.toArray(); const classes = createMemo(() => { if (themeContextValue) { return themeContextValue.componentsTV.breadcrumbs(); } return breadcrumbsDefaultStyle(); }); return (
    {(child, index) => ( <>
  1. {child}
  2. {(index() !== (items.length - 1)) ? (
  3. {local.seperator}
  4. ) : null} )}
); }; export default Breadcrumbs;