Skip to content

Commit edb22f4

Browse files
committed
Test the idea of packaging the image with data.
1 parent 79aa390 commit edb22f4

3 files changed

Lines changed: 148 additions & 146 deletions

File tree

example-data/data.json

Lines changed: 146 additions & 143 deletions
Large diffs are not rendered by default.

src/dashboard/categories.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ const toDate = o => {
55
return o;
66
};
77
const byDate = (a, b) => { return b.date - a.date; };
8-
export const categories = data.map(cat => cat.id);
9-
8+
export const categories = data.map(({ id, name, description, img }) => ({ id, name, description, img }));
109
export const getPapers = ({ id, limit = 20 }) => {
1110
let papers = [];
1211
const category = data.find(cat => cat.id === id);

src/dashboard/category-card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function CategoryCard ({ category, store, selectable = true, incl
88
h('div', {
99
class: 'category-bg-img',
1010
style: {
11-
'background-image': `url("img/${category.id}.jpg")`
11+
'background-image': `url("${category.img}")`
1212
}
1313
}),
1414
includeName

0 commit comments

Comments
 (0)