All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.core.Breadcrumb.DefaultBreadcrumb.tsx Maven / Gradle / Ivy

There is a newer version: 7.28.3
Show newest version
import React, { ReactElement, useMemo } from 'react'
import { Breadcrumb, BreadcrumbItem, BreadcrumbProps } from 'reactstrap'
import classNames from 'classnames'
import { useSelector } from 'react-redux'

// @ts-ignore ignore import error from js file
import { breadcrumbsSelector } from '../../../ducks/global/selectors'
import { ElementVisibility, WindowType } from '../WindowType'

import { breadcrumb } from './const'
import { Crumb } from './Crumb'

export function SimpleBreadcrumb({ items = [] }: { items: breadcrumb }): ReactElement {
    const routes: Record = useSelector(breadcrumbsSelector)

    return (
        
            {
                items.map(({ label, path }) => {
                    const disabled = !path
                    const pathName = path && routes[path] ? `${path}${routes[path]}` : path

                    return (
                        
                            
                        
                    )
                })
            }
        
    )
}

export function DefaultBreadcrumb({ items = [] }: { items: breadcrumb }): ReactElement | null {
    const { N2O_ELEMENT_VISIBILITY = { breadcrumb: true } as ElementVisibility } = window as WindowType

    const isBreadcrumbHidden = useMemo(
        () => (!items.length || !N2O_ELEMENT_VISIBILITY.breadcrumb),
        [N2O_ELEMENT_VISIBILITY.breadcrumb, items.length],
    )

    return isBreadcrumbHidden ? null : 
}

export default DefaultBreadcrumb




© 2015 - 2025 Weber Informatics LLC | Privacy Policy