Skip to content

Commit 947eebd

Browse files
committed
Use Peregrine's List component for lists
1 parent ad8c187 commit 947eebd

File tree

4 files changed

+8
-27
lines changed

4 files changed

+8
-27
lines changed

packages/venia-concept/src/components/ProductImageCarousel/thumbnailList.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
import { Component, createElement } from 'react';
22
import PropTypes from 'prop-types';
3+
import { List } from '@magento/peregrine';
34

45
import classify from 'src/classify';
5-
import List from 'src/components/List';
66
import Thumbnail from './thumbnail';
77
import defaultClasses from './thumbnailList.css';
88

9-
const getItemKey = ({ id }) => id;
10-
119
class ThumbnailList extends Component {
1210
static propTypes = {
1311
classes: PropTypes.shape({
1412
root: PropTypes.string
1513
}),
16-
items: PropTypes.oneOfType([
17-
PropTypes.instanceOf(Map),
18-
PropTypes.arrayOf(PropTypes.object)
19-
])
14+
items: PropTypes.arrayOf(PropTypes.object).isRequired
2015
};
2116

2217
render() {
23-
return (
24-
<List
25-
renderItem={Thumbnail}
26-
getItemKey={getItemKey}
27-
{...this.props}
28-
/>
29-
);
18+
return <List renderItem={Thumbnail} {...this.props} />;
3019
}
3120
}
3221

packages/venia-concept/src/components/ProductOptions/swatchList.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { Component, createElement } from 'react';
22
import PropTypes from 'prop-types';
3+
import { List } from '@magento/peregrine';
34

45
import classify from 'src/classify';
5-
import List from 'src/components/List';
66
import Swatch from './swatch';
77
import defaultClasses from './swatchList.css';
88

9-
const getItemKey = ({ id }) => id;
10-
119
class SwatchList extends Component {
1210
static propTypes = {
1311
classes: PropTypes.shape({
@@ -17,9 +15,7 @@ class SwatchList extends Component {
1715
};
1816

1917
render() {
20-
return (
21-
<List renderItem={Swatch} getItemKey={getItemKey} {...this.props} />
22-
);
18+
return <List renderItem={Swatch} {...this.props} />;
2319
}
2420
}
2521

packages/venia-concept/src/components/ProductOptions/tileList.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { Component, createElement } from 'react';
22
import PropTypes from 'prop-types';
3+
import { List } from '@magento/peregrine';
34

45
import classify from 'src/classify';
5-
import List from 'src/components/List';
66
import Tile from './tile';
77
import defaultClasses from './tileList.css';
88

9-
const getItemKey = ({ id }) => id;
10-
119
class TileList extends Component {
1210
static propTypes = {
1311
classes: PropTypes.shape({
@@ -17,9 +15,7 @@ class TileList extends Component {
1715
};
1816

1917
render() {
20-
return (
21-
<List renderItem={Tile} getItemKey={getItemKey} {...this.props} />
22-
);
18+
return <List renderItem={Tile} {...this.props} />;
2319
}
2420
}
2521

packages/venia-concept/src/components/Select/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component, createElement } from 'react';
22
import PropTypes from 'prop-types';
3+
import { List } from '@magento/peregrine';
34

45
import classify from 'src/classify';
5-
import List from 'src/components/List';
66
import Option from './option';
77
import defaultClasses from './select.css';
88

0 commit comments

Comments
 (0)