Skip to content

Commit

Permalink
feat(gallery): updates ordering of modules to be alphabetical (#606)
Browse files Browse the repository at this point in the history
add a sort to modulesByRenderer

fixes #605
  • Loading branch information
2xAA authored Jul 1, 2021
1 parent a0db3c9 commit 48f0075
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/components/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,24 @@ export default {
},
modulesByRenderer() {
return Object.keys(this.registeredModules).reduce((obj, key) => {
const module = this.registeredModules[key];
const { type, name } = module.meta;
if (!(type in obj)) {
obj[type] = {};
}
return Object.keys(this.registeredModules)
.sort((a, b) =>
this.registeredModules[a].meta.name.localeCompare(
this.registeredModules[b].meta.name
)
)
.reduce((obj, key) => {
const module = this.registeredModules[key];
const { type, name } = module.meta;
if (!(type in obj)) {
obj[type] = {};
}
obj[type][name] = module;
obj[type][name] = module;
return obj;
}, {});
return obj;
}, {});
}
},
Expand Down

0 comments on commit 48f0075

Please sign in to comment.