You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
882 B
JavaScript
29 lines
882 B
JavaScript
import ItemListingEntry from './ItemListingEntry.js';
|
|
import _Item from './_Item.js';
|
|
|
|
function ItemListing(initialVnode) {
|
|
var chosen_images = {
|
|
items: null,
|
|
chosen_images: []
|
|
};
|
|
return {
|
|
view: function(vnode) {
|
|
//var items = _Item.filter(vnode.attrs.filter);
|
|
//var items = _Item.collection;
|
|
var items = vnode.attrs.items;
|
|
if(items.length === 0){
|
|
return m('h5', 'Please contact us directly to order.');
|
|
}
|
|
if(chosen_images.items !== items){
|
|
chosen_images.chosen_images = items.map(function(item){
|
|
return item.image_ids[0];
|
|
});
|
|
chosen_images.items = items;
|
|
}
|
|
return m(".columns", items.map(function(item, i){
|
|
return m(ItemListingEntry, {item:item, index: i, chosen_images: chosen_images.chosen_images})
|
|
}));
|
|
}
|
|
}
|
|
}
|
|
export default ItemListing |