| 1 |
import { toggleEqualHeight } from "../shared/helpFn"; |
| 2 |
import { Fragment, useEffect, useRef } from "@wordpress/element"; |
| 3 |
import LoopContent from "./loopContent"; |
| 4 |
import { breakpoint } from "../../controls/controls"; |
| 5 |
|
| 6 |
const Render = ({ attributes, posts }) => { |
| 7 |
const { |
| 8 |
uniqueId, |
| 9 |
postGridLayout, |
| 10 |
equalHeightEnable, |
| 11 |
catTabCategoryPosition, |
| 12 |
// gridThreeMasonryEnable, |
| 13 |
} = attributes; |
| 14 |
|
| 15 |
const deviceType = breakpoint(); |
| 16 |
const containerRef = useRef(null); |
| 17 |
|
| 18 |
useEffect(() => { |
| 19 |
toggleEqualHeight(uniqueId, equalHeightEnable); |
| 20 |
}, [equalHeightEnable, uniqueId, []]); |
| 21 |
|
| 22 |
// const HtmlTag = gridThreeMasonryEnable ? Fragment : 'div'; |
| 23 |
const HtmlTag = "div"; |
| 24 |
|
| 25 |
return ( |
| 26 |
<div |
| 27 |
className={`sp-smart-show-pro grid-three-container sp-cat-position-${catTabCategoryPosition}`} |
| 28 |
ref={containerRef} |
| 29 |
> |
| 30 |
<div className={`sp-smart-post-grid-three-contents ${postGridLayout}`}> |
| 31 |
{"Mobile" !== deviceType && ( |
| 32 |
<div |
| 33 |
className={`sp-smart-post-static-grid-contents sp-smart-post-background-layout ${postGridLayout}`} |
| 34 |
> |
| 35 |
<LoopContent posts={posts} attributes={attributes} containerRef={containerRef} /> |
| 36 |
</div> |
| 37 |
)} |
| 38 |
<HtmlTag |
| 39 |
className={`sp-smart-post-dynamic-grid-contents sp-smart-post-background-layout ${postGridLayout}`} |
| 40 |
> |
| 41 |
<LoopContent |
| 42 |
bottomStyle={true} |
| 43 |
// Masonry={ gridThreeMasonryEnable ? Masonry : false } |
| 44 |
// ResponsiveMasonry={ |
| 45 |
// gridThreeMasonryEnable |
| 46 |
// ? ResponsiveMasonry |
| 47 |
// : Fragment |
| 48 |
// } |
| 49 |
Masonry={false} |
| 50 |
ResponsiveMasonry={Fragment} |
| 51 |
posts={posts} |
| 52 |
attributes={attributes} |
| 53 |
containerRef={containerRef} |
| 54 |
/> |
| 55 |
</HtmlTag> |
| 56 |
</div> |
| 57 |
</div> |
| 58 |
); |
| 59 |
}; |
| 60 |
|
| 61 |
export default Render; |
| 62 |
|