-
Notifications
You must be signed in to change notification settings - Fork 50
/
List.js
38 lines (34 loc) 路 848 Bytes
/
List.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import PropTypes from 'prop-types';
import Masonry from 'react-masonry-component';
import Item from '@/components/Item';
export default class List extends React.Component {
static propTypes = {
items: PropTypes.array
};
constructor(props) {
super(props);
}
render() {
return (
<Masonry
ref={ref => (this.masonryRef = ref)}
className="masonry"
elementType="div"
options={{ transitionDuration: 0 }}
disableImagesLoaded={false}
updateOnEachImageLoad={false}>
{this.props.items.map((elem, index) => {
return (
<Item
key={elem.unique_id}
index={index}
item={elem}
masonry={this.masonryRef}
/>
);
})}
</Masonry>
);
}
}