Created
June 30, 2017 19:06
-
-
Save farism/61b0adcfc1f17b76a68d93c5edd739b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gridView = ( | |
rowHeight, | |
numCols, | |
deleteTile, | |
updateLayout, | |
setDrilldown, | |
isSidebarOpen, | |
tiles, | |
) => ( | |
<AutoSizedReactGridLayout | |
className="layout" | |
cols={numCols} | |
isDraggable={isSidebarOpen} | |
isResizable={isSidebarOpen} | |
layout={null} | |
margin={[16, 16]} | |
onDragStop={(layout, { x, y }, { x: newX, y: newY }) => { | |
if (newX !== x || newY !== y) { | |
updateLayout(layout); | |
setTimeout(resize, 50); | |
} | |
}} | |
onResizeStop={(layout, { w, h }, { w: newW, h: newH }) => { | |
if (newW !== w || newH !== h) { | |
updateLayout(layout); | |
setTimeout(resize, 50); | |
} | |
}} | |
onResize={() => { | |
setTimeout(resize, 250); | |
}} | |
rowHeight={rowHeight || 400} | |
> | |
{tiles.map(tile => ( | |
<div | |
key={tile.get('chart_id').toString()} | |
data-grid={tile.get('layout').toJS()} | |
styleName="grid-item" | |
> | |
{tileView(deleteTile, setDrilldown, isSidebarOpen, tile)} | |
</div> | |
))} | |
</AutoSizedReactGridLayout> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment