Skip to content

Commit

Permalink
Merge pull request #236 from nucleogenesis/232-learning-activity-icons
Browse files Browse the repository at this point in the history
232 learning activity icons
  • Loading branch information
sairina authored Jun 14, 2021
2 parents 50ca135 + 428d675 commit e80c59b
Show file tree
Hide file tree
Showing 33 changed files with 358 additions and 10 deletions.
6 changes: 6 additions & 0 deletions custom-icons/all-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions custom-icons/create-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/create-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/interact-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/interact-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/listen-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/listen-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/practice-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/practice-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/read-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/read-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions custom-icons/reflect-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions custom-icons/reflect-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/watch-shaded.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions custom-icons/watch-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 34 additions & 10 deletions docs/pages/icons/IconTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
/>
</div>

<h3 v-if="displayedWithColor.length">
Learning activities
</h3>
<div class="icon-table">
<IconBlock
v-for="(aliasList, index) in displayedLearningActivity"
:key="index"
:aliasList="aliasList"
class="icon-block"
/>
</div>
</div>

</template>
Expand Down Expand Up @@ -60,16 +71,14 @@
* Return an object where the keys are unique icon identifiers. These identifiers
* map to an array of alphabetically sorted aliases associated with that icon.
*
* Parameter `withDefaultColor` selects icons with or without a defined default color.
* Parameter `filterFn` must take 1 alias and return true or false. When false, the alias
* will not be included in the output.
*/
function getIconGroups(withDefaultColor) {
function getIconGroups(filterFn) {
const iconGroups = {};
Object.keys(KolibriIcons).forEach(alias => {
// exit if not applicable
const hasDefaultColor = Boolean(KolibriIcons[alias].defaultColor);
if ((withDefaultColor && !hasDefaultColor) || (!withDefaultColor && hasDefaultColor)) {
return;
}
const filteredIcons = Object.keys(KolibriIcons).filter(filterFn);
filteredIcons.forEach(alias => {
// track a list of aliases
const iconIdentifier = KolibriIcons[alias].icon.name;
if (iconGroups[iconIdentifier]) {
Expand All @@ -96,17 +105,23 @@
return termList(this.filterText);
},
general() {
return sortedIconAliases(getIconGroups(false));
return sortedIconAliases(getIconGroups(this.blackIconFilter));
},
displayedGeneral() {
return this.general.filter(this.termFilter);
},
withColor() {
return sortedIconAliases(getIconGroups(true));
return sortedIconAliases(getIconGroups(this.iconWithDefaultColorFilter));
},
displayedWithColor() {
return this.withColor.filter(this.termFilter);
},
withLearningActivity() {
return sortedIconAliases(getIconGroups(this.learningActivityIconFilter));
},
displayedLearningActivity() {
return this.withLearningActivity.filter(this.termFilter);
},
},
methods: {
termFilter(aliasList) {
Expand All @@ -117,6 +132,15 @@
}
return false;
},
blackIconFilter(alias) {
return !KolibriIcons[alias].defaultColor && !KolibriIcons[alias].learningActivity;
},
iconWithDefaultColorFilter(alias) {
return Boolean(KolibriIcons[alias].defaultColor);
},
learningActivityIconFilter(alias) {
return KolibriIcons[alias].learningActivity;
},
},
};
Expand Down
Loading

0 comments on commit e80c59b

Please sign in to comment.