We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3161e29 commit 74e313eCopy full SHA for 74e313e
1 file changed
dotcom-rendering/src/types/hostedContent.ts
@@ -1,5 +1,29 @@
1
import { FEHostedContent } from 'src/frontend/feHostedContent';
2
3
+enum HostedContentType {
4
+ Article,
5
+ Video,
6
+ Gallery,
7
+}
8
+
9
export type HostedContent = {
10
frontendData: FEHostedContent;
11
+ type: HostedContentType;
12
+};
13
14
+export const enhanceHostedContentType = (
15
+ data: FEHostedContent,
16
+): HostedContent => {
17
+ let type = HostedContentType.Article;
18
19
+ if (data.video) {
20
+ type = HostedContentType.Video;
21
+ } else if (data.images.length) {
22
+ type = HostedContentType.Gallery;
23
+ }
24
25
+ return {
26
+ frontendData: data,
27
+ type,
28
+ };
29
};
0 commit comments