import React from 'react' import { Icon } from '../../Icons/Icon' export const Breadcrumb: React.FC = React.memo( ({ Link, currentTitle, previousTitle, previousHref, className = '' }) => { const renderPrevTitle = ( {previousTitle} ) const renderPrevIcon = ( ) const renderPrevLink = () => { if (!previousHref && !Link) { // Previous page don't have link return {renderPrevTitle} } if (Link) { // Previous page using custom link element return ( {renderPrevIcon} {renderPrevTitle} ) } // Default previous link return ( {renderPrevIcon} {renderPrevTitle} ) } return (
{previousTitle && ( {renderPrevLink()} / )} {currentTitle}
{/* NOT IMPLEMENTED */}
{/* NOT IMPLEMENTED */}
) } ) export interface BreadcrumbProps { /** * Custom class name * */ className?: string /** * Current page title * */ currentTitle: string /** * Previous page title * */ previousTitle?: string /** * Previous page href * */ previousHref?: string /** * Custom link component (replace ) * Example: `const Link = (props: any) => { return {props.children} }` * */ Link?: React.ElementType }