-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry-type-color.ts
45 lines (43 loc) · 1.18 KB
/
entry-type-color.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { getEntryType } from "../helper";
import { EntryType } from "../types";
import { ENTRY_TYPE } from "../constants";
/**
* Get type for entry like Page, BlogEntry, School Subject and more
*/
export const entryTypeColorFormatter = {
name: "entry-type-color",
read(type?: EntryType | ENTRY_TYPE) {
if (typeof type === "string") {
type = getEntryType(type);
}
switch (type) {
case ENTRY_TYPE.News:
case ENTRY_TYPE.Post:
case ENTRY_TYPE.Blog:
return "green";
case ENTRY_TYPE.Page:
case ENTRY_TYPE.Home:
case ENTRY_TYPE.Podcast:
case ENTRY_TYPE.PodcastEpisode:
return "cyan";
case ENTRY_TYPE.SchoolSubject:
case ENTRY_TYPE.WorkingGroup:
return "greenlight";
case ENTRY_TYPE.Navigation:
case ENTRY_TYPE.Calendar:
case ENTRY_TYPE.Teacher:
return "blue";
// TODO
case ENTRY_TYPE.Image:
case ENTRY_TYPE.Text:
case ENTRY_TYPE.BlackboardSlideshow:
case ENTRY_TYPE.Facts:
case ENTRY_TYPE.GallerySlideshow:
case ENTRY_TYPE.Slideshow:
return "muted";
case ENTRY_TYPE.Unknown:
default:
return "red";
}
},
};