1- import { forwardRef , HTMLAttributes } from 'react'
2- import type { BackgroundColours , BackgroundTypes , ImageBackground } from '../../types/index'
3- import { BackgroundContainerType , BackgroundStyle , ColouredContainer } from './ColouredContainer'
4- import { ColorKeyTokens } from '../../styles/colorKeyToUtilityMap'
1+ import { forwardRef , type HTMLAttributes } from 'react'
2+ import type { ColorKeyTokens } from '../../styles/colorKeyToUtilityMap'
53import envisTwMerge from '../../twMerge'
4+ import type { BackgroundColours , BackgroundTypes , ImageBackground } from '../../types/index'
5+ import { type BackgroundContainerType , type BackgroundStyle , ColouredContainer } from './ColouredContainer'
66import { ImageBackgroundContainer } from './ImageBackgroundContainer'
77
88export type BackgroundContainerProps = {
@@ -43,7 +43,6 @@ export const BackgroundContainer = forwardRef<HTMLDivElement, BackgroundContaine
4343 dontSplit = false ,
4444 as = 'div' ,
4545 backgroundStyle = 'regular' ,
46- ...rest
4746 } ,
4847 ref ,
4948) {
@@ -54,7 +53,6 @@ export const BackgroundContainer = forwardRef<HTMLDivElement, BackgroundContaine
5453 { type === 'backgroundImage' && backgroundImage && (
5554 < ImageBackgroundContainer
5655 as = { as }
57- { ...rest }
5856 ref = { ref }
5957 id = { id }
6058 { ...backgroundImage }
@@ -65,30 +63,26 @@ export const BackgroundContainer = forwardRef<HTMLDivElement, BackgroundContaine
6563 { children }
6664 </ ImageBackgroundContainer >
6765 ) }
68- { ( type === 'backgroundColor' || ! type ) && (
69- < >
70- { as == 'div' &&
71- renderFragmentWhenPossible &&
72- ( restBackground ?. backgroundColor === 'White' || restBackground ?. backgroundUtility === 'white-100' ) &&
73- className === '' &&
74- ! id ? (
75- < > { children } </ >
76- ) : (
77- < ColouredContainer
78- ref = { ref }
79- id = { id }
80- { ...restBackground }
81- style = { style }
82- as = { as }
83- backgroundStyle = { backgroundStyle }
84- className = { envisTwMerge ( `${ id ? 'scroll-mt-topbar' : '' } ` , className , twClassName ) }
85- { ...rest }
86- >
87- { children }
88- </ ColouredContainer >
89- ) }
90- </ >
91- ) }
66+ { ( type === 'backgroundColor' || ! type ) &&
67+ ( as === 'div' &&
68+ renderFragmentWhenPossible &&
69+ ( restBackground ?. backgroundColor === 'White' || restBackground ?. backgroundUtility === 'white-100' ) &&
70+ className === '' &&
71+ ! id ? (
72+ children
73+ ) : (
74+ < ColouredContainer
75+ ref = { ref }
76+ id = { id }
77+ { ...restBackground }
78+ style = { style }
79+ as = { as }
80+ backgroundStyle = { backgroundStyle }
81+ className = { envisTwMerge ( `${ id ? 'scroll-mt-topbar' : '' } ` , className , twClassName ) }
82+ >
83+ { children }
84+ </ ColouredContainer >
85+ ) ) }
9286 </ >
9387 )
9488} )
0 commit comments