Skip to content

Commit

Permalink
v1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Delpoux committed Sep 28, 2017
1 parent c8f2ff2 commit 4d95afa
Show file tree
Hide file tree
Showing 5 changed files with 550 additions and 318 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.3.3 - 2017-09-28

* Add: custom className support
* Add: single node children support
* Fix: do not reset this.container

# 1.2.3 - 2017-06-14

* Update: handle default columns count
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-responsive-masonry",
"version": "1.2.3",
"version": "1.3.3",
"description": "React responsive masonry component built with css flexbox",
"repository": {
"type": "git",
Expand Down
6 changes: 3 additions & 3 deletions src/Masonry.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ class Masonry extends Component {
Masonry.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
PropTypes.node,
]).isRequired,
columnsCount: PropTypes.number,
gutter: PropTypes.string,
className: PropTypes.string
className: PropTypes.string,
}

Masonry.defaultProps = {
columnsCount: 3,
gutter: "0",
className: null
className: null,
}

export default Masonry
18 changes: 9 additions & 9 deletions src/ResponsiveMasonry.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class MasonryResponsive extends Component {
const {columnsCountBreakPoints} = this.props
const containerWidth = this.container.offsetWidth
const breakPoints = this.getSortedBreakPoints()
let columnsCount = breakPoints.length > 0
? columnsCountBreakPoints[breakPoints[0]]
: DEFAULT_COLUMNS_COUNT
let columnsCount =
breakPoints.length > 0
? columnsCountBreakPoints[breakPoints[0]]
: DEFAULT_COLUMNS_COUNT

breakPoints.forEach(breakPoint => {
if (breakPoint < containerWidth) {
Expand All @@ -52,9 +53,8 @@ class MasonryResponsive extends Component {
this.updateColumnsCount()
}

handleRef (ref) {
if (!this.container)
this.container = ref
handleRef(ref) {
if (!this.container) this.container = ref
}

render() {
Expand All @@ -74,10 +74,10 @@ class MasonryResponsive extends Component {
MasonryResponsive.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.node),
PropTypes.node
PropTypes.node,
]).isRequired,
columnsCountBreakPoints: PropTypes.object,
className: PropTypes.string
className: PropTypes.string,
}

MasonryResponsive.defaultProps = {
Expand All @@ -86,7 +86,7 @@ MasonryResponsive.defaultProps = {
750: 2,
900: 3,
},
className: null
className: null,
}

export default MasonryResponsive
Loading

0 comments on commit 4d95afa

Please sign in to comment.