import { FC, useEffect, useRef } from 'react'; import { AutoGrid, AutoGridProps, LayoutGridItem } from '../../../../../common'; import { useCatalogData } from '../../../../../hooks'; import { getFurniIconUrl } from '../common/getFurniIconUrl'; interface CatalogBundleGridWidgetViewProps extends AutoGridProps { } export const CatalogBundleGridWidgetView: FC = props => { const { columnCount = 5, children = null, ...rest } = props; const { currentOffer = null } = useCatalogData(); const elementRef = useRef(null); useEffect(() => { if(elementRef && elementRef.current) elementRef.current.scrollTop = 0; }, [ currentOffer ]); if(!currentOffer) return null; return ( { currentOffer.products && (currentOffer.products.length > 0) && currentOffer.products.map((product, index) => ) } { children } ); };