diff --git a/packages/dnb-design-system-portal/src/docs/uilib/components/breadcrumb/Examples.js b/packages/dnb-design-system-portal/src/docs/uilib/components/breadcrumb/Examples.js index 22798df2cb3..2210fb4e1a8 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/components/breadcrumb/Examples.js +++ b/packages/dnb-design-system-portal/src/docs/uilib/components/breadcrumb/Examples.js @@ -45,7 +45,7 @@ export const BreadcrumbMultipleData = () => ( ]; return ( - + ) } ` @@ -89,7 +89,7 @@ export const BreadcrumbVariants = () => ( return ( // Try changing variant here - + ) } ` diff --git a/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx b/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx index db8abf5137c..cd16c119520 100644 --- a/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx +++ b/packages/dnb-eufemia/src/components/breadcrumb/Breadcrumb.tsx @@ -20,6 +20,7 @@ import { convertJsxToString, validateDOMAttributes, } from '../../shared/component-helper' +import { BreadcrumbMultiple } from './BreadcrumbMultiple' export interface BreadcrumbProps { /** @@ -111,6 +112,12 @@ export interface BreadcrumbProps { * Default: false */ spacing?: boolean + + /** + * Will disable the height animation + * Default: false + */ + noAnimation?: boolean } export const defaultProps = { @@ -128,6 +135,7 @@ export const defaultProps = { const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { // Every component should have a context const context = React.useContext(Context) + // Extract additional props from global context const allProps = usePropsWithContext( localProps, @@ -136,10 +144,11 @@ const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { context?.Breadcrumb, { skeleton: context?.skeleton } ) + const { className, skeleton, - children: childrenItems, + children: items, variant, onClick, navText, // has a translation in context @@ -150,6 +159,7 @@ const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { collapsedStyleType, isCollapsed: overrideIsCollapsed, spacing, + noAnimation, data, href, ...props @@ -165,7 +175,7 @@ const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { let currentVariant = variant if (!variant) { - if (childrenItems || data) { + if (items || data) { currentVariant = isSmallScreen ? 'collapse' : 'multiple' } else { currentVariant = 'single' @@ -176,24 +186,6 @@ const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { setCollapse(overrideIsCollapsed) }, [overrideIsCollapsed]) - const MultipleCrumbs = () => ( -
    - {data?.map((breadcrumbItem, i) => ( - - ))} - - {childrenItems} -
- ) - validateDOMAttributes(allProps, props) return ( @@ -237,16 +229,24 @@ const Breadcrumb = (localProps: BreadcrumbProps & ISpacingProps) => { /> )} - {currentVariant === 'multiple' && } + {currentVariant === 'multiple' && ( + + )} - {currentVariant === 'collapse' && !isCollapsed && ( -
- + {currentVariant === 'collapse' && ( +
+
)} diff --git a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx index 704e3e05a66..483f57506ff 100644 --- a/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx +++ b/packages/dnb-eufemia/src/components/breadcrumb/BreadcrumbItem.tsx @@ -51,6 +51,8 @@ export interface BreadcrumbItemProps { * Default: null */ skeleton?: SkeletonShow + + style?: React.CSSProperties } const defaultProps = { @@ -72,7 +74,7 @@ const BreadcrumbItem = (localProps: BreadcrumbItemProps) => { } = context // Extract additional props from global context - const { text, href, icon, onClick, variant, skeleton, ...props } = + const { text, href, icon, onClick, variant, skeleton, style, ...props } = usePropsWithContext(localProps, defaultProps, context?.BreadcrumbItem) const currentIcon: IconPrimaryIcon = @@ -85,6 +87,7 @@ const BreadcrumbItem = (localProps: BreadcrumbItemProps) => { className="dnb-breadcrumb__item" data-testid="breadcrumb-item" aria-current={variant === 'current' ? 'page' : undefined} + style={style} > {isInteractive ? (