Last active
February 3, 2017 22:25
-
-
Save jeffvan576/dd6ad36869fff28be9043d9e28307135 to your computer and use it in GitHub Desktop.
This file contains 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
// Import scrollbar size helper | |
import scrollbarSize from 'dom-helpers/util/scrollbarSize'; | |
// Helper function | |
adjusted (width, height) { | |
const { | |
columnWidth, | |
columnCount, | |
rowHeight, | |
rowCount, | |
} = this.state; | |
const totalGridWidth = columnWidth * columnCount; | |
const totalGridHeight = rowHeight * rowCount; | |
const widthTest = totalGridWidth > width; | |
const heightTest = totalGridHeight > height && widthTest; | |
return { | |
width: widthTest ? width - scrollbarSize() : width, | |
height: heightTest ? height - scrollbarSize() : height, | |
}; | |
} | |
// Grid / Autosizer implementation | |
<AutoSizer> | |
{({ width, height }) => { | |
const adjustedMeasurement = this.adjusted(width, height); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment