-
Notifications
You must be signed in to change notification settings - Fork 34
/
ViewerItemCardType.ts
70 lines (70 loc) · 1.64 KB
/
ViewerItemCardType.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**
* complex enum simple emulation
* kind of Factory with static singleton ViewerItemCardType constants.
*
* Resources:
* - TypeScript enums: https://github.com/Microsoft/TypeScript/issues/1206#issuecomment-296441490
* - Using real factory sample: https://github.com/torokmark/contact-me/issues/2
* - More about enums: https://basarat.gitbooks.io/typescript/content/docs/enums.html#enum-with-static-functions
* - Singleton: https://basarat.gitbooks.io/typescript/docs/tips/singleton.html
* - Similar sample: https://codepen.io/ImagineProgramming/pen/GZMXWe?editors=0010#0
*/
export class ViewerItemCardType {
public static Big: ViewerItemCardType = new ViewerItemCardType(
1,
"FeaturedBig",
330,
660,
110,
160,
21,
16,
68,
18,
58
);
public static Medium: ViewerItemCardType = new ViewerItemCardType(
2,
"FeaturedSmall",
155,
310,
50,
125,
20,
14,
66,
16,
68
);
public static Small: ViewerItemCardType = new ViewerItemCardType(
3,
"NormalArticle",
100,
200,
35,
115,
18,
12,
62,
14,
75
);
public static All: ViewerItemCardType[] = [
ViewerItemCardType.Big,
ViewerItemCardType.Medium,
ViewerItemCardType.Small
];
private constructor(
public id: number,
public name: string,
public imageHeight: number,
public imageWidth: number,
public titleMaxWords: number,
public summaryMaxWords: number,
public titleFontSize: number,
public summaryFontSize: number,
public titleMinHeight: number,
public dateMinHeight: number,
public summaryMinHeight: number
) {}
}