diff --git a/contentcuration/contentcuration/frontend/shared/utils/icons.js b/contentcuration/contentcuration/frontend/shared/utils/icons.js new file mode 100644 index 0000000000..cd07955e3c --- /dev/null +++ b/contentcuration/contentcuration/frontend/shared/utils/icons.js @@ -0,0 +1,22 @@ +import { ContentKindsNames } from 'shared/leUtils/ContentKinds'; + +const EMPTY = '_empty'; +const CONTENT_KIND_ICONS = { + [ContentKindsNames.TOPIC]: 'topic', + [ContentKindsNames.TOPIC + EMPTY]: 'emptyTopic', + [ContentKindsNames.VIDEO]: 'video', + [ContentKindsNames.AUDIO]: 'audio', + [ContentKindsNames.SLIDESHOW]: 'slideshow', + [ContentKindsNames.EXERCISE]: 'exercise', + [ContentKindsNames.DOCUMENT]: 'document', + [ContentKindsNames.HTML5]: 'html5', + [ContentKindsNames.ZIM]: 'html5', +}; + +export function getContentKindIcon(kind, isEmpty = false) { + const icon = (isEmpty ? [kind + EMPTY] : []).concat([kind]).find(k => k in CONTENT_KIND_ICONS); + if (!icon) { + throw new Error(`Icon not found for content kind: ${kind}`); + } + return CONTENT_KIND_ICONS[icon]; +} diff --git a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelThumbnail.vue b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelThumbnail.vue index d8a5a07d84..25d4a7fbb3 100644 --- a/contentcuration/contentcuration/frontend/shared/views/channel/ChannelThumbnail.vue +++ b/contentcuration/contentcuration/frontend/shared/views/channel/ChannelThumbnail.vue @@ -16,7 +16,7 @@ > - @@ -46,42 +45,33 @@ v-else-if="printing" class="printable-icon" > - - {{ icon }} - + /> - - - - +
- +
@@ -89,8 +79,8 @@