Skip to content

Commit

Permalink
Add: prop on component
Browse files Browse the repository at this point in the history
  • Loading branch information
xuopled committed Apr 13, 2017
1 parent 9e159d1 commit 2d4e739
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

* Add: `Masonry` component
* Add: `ResponsiveMasonry` component

# 1.1.0 - 2017-04-13

* Add: `gutter` prop on `Mansory` component
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class MyWrapper extends Component {

### Mansonry component
* `columnsCount`: Number - injected by ResponsiveMasonry - default 3,
* `gutter`: String - margin surrounding each item (in pixels) - default "0",

### ResponsiveMasonry component
* `columnsCountBreakPoints`: Object, keys are breakpoints in px, values are the columns number - default {350: 1, 750: 2, 900: 3},
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.0.0",
"version": "1.1.0",
"description": "React responsive masonry component built with css flexbox",
"browser": "./dist/index.js",
"main": "lib/index.js",
Expand Down
8 changes: 4 additions & 4 deletions src/Masonry.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ const styles = {
flexGrow: 1,
flexBasis: 0,
},
item: {
margin: "5px",
},
}

class Masonry extends Component {
Expand All @@ -41,8 +38,9 @@ class Masonry extends Component {
}

renderColumn(column) {
const {gutter} = this.props
return column.map((item, i) => (
<div key={i} style={styles.item}>
<div key={i} style={{margin: gutter}}>
{item}
</div>
))
Expand All @@ -68,10 +66,12 @@ class Masonry extends Component {
Masonry.propTypes = {
children: PropTypes.array.isRequired,
columnsCount: PropTypes.number,
gutter: PropTypes.string,
}

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

export default Masonry

0 comments on commit 2d4e739

Please sign in to comment.