| 1 |
import { jsonParse, 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 |
// gridFiveMasonryEnable, |
| 12 |
catTabCategoryPosition, |
| 13 |
} = attributes; |
| 14 |
|
| 15 |
const deviceType = breakpoint(); |
| 16 |
const gridRef = useRef(null); |
| 17 |
|
| 18 |
useEffect(() => { |
| 19 |
toggleEqualHeight(uniqueId, equalHeightEnable); |
| 20 |
}, [equalHeightEnable, uniqueId, []]); |
| 21 |
|
| 22 |
const HtmlTag = "div"; |
| 23 |
|
| 24 |
return ( |
| 25 |
<div |
| 26 |
className={`sp-smart-show-pro grid-five-container sp-cat-position-${catTabCategoryPosition}`} |
| 27 |
ref={gridRef} |
| 28 |
> |
| 29 |
{"Mobile" !== deviceType && ( |
| 30 |
<div |
| 31 |
className={`sp-smart-post-grid-five-dynamic-contents sp-smart-post-background-layout ${postGridLayout}`} |
| 32 |
> |
| 33 |
<LoopContent posts={posts} attributes={attributes} gridRef={gridRef} /> |
| 34 |
</div> |
| 35 |
)} |
| 36 |
<HtmlTag |
| 37 |
className={`sp-smart-post-grid-five-static-contents sp-smart-post-background-layout ${postGridLayout}`} |
| 38 |
> |
| 39 |
<LoopContent |
| 40 |
bottomStyle={true} |
| 41 |
Masonry={false} |
| 42 |
ResponsiveMasonry={Fragment} |
| 43 |
posts={posts} |
| 44 |
attributes={attributes} |
| 45 |
gridRef={gridRef} |
| 46 |
/> |
| 47 |
</HtmlTag> |
| 48 |
</div> |
| 49 |
); |
| 50 |
}; |
| 51 |
|
| 52 |
export default Render; |
| 53 |
|