Skip to content

Commit

Permalink
[DEV-7584] Added layout to VideoNode
Browse files Browse the repository at this point in the history
  • Loading branch information
fgyimah committed Aug 18, 2023
1 parent 21d4bed commit 271bd79
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/content-format/src/nodes/VideoNode.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { OEmbedInfo as OEmbed } from '../common';
import { Element } from '../Element';
import { isNonEmptyString, isUuid } from '../validation';
import { isEnum, isNonEmptyString, isUuid } from '../validation';

export interface VideoNode extends Element<typeof VideoNode.TYPE> {
uuid: string;
url: string;
oembed: VideoNode.OEmbedInfo;
layout: `${VideoNode.Layout}`;
}

export namespace VideoNode {
export const TYPE = 'video';

export enum Layout {
CONTAINED = 'contained',
EXPANDED = 'expanded',
FULL_WIDTH = 'full-width',
}

export import OEmbedInfo = OEmbed;

export function isVideoNode(value: any): value is VideoNode {
Expand All @@ -22,7 +29,8 @@ export namespace VideoNode {
isVideoNode(value) &&
isNonEmptyString(value.url) &&
isUuid(value.uuid) &&
OEmbed.isOEmbedInfo(value.oembed);
OEmbed.isOEmbedInfo(value.oembed) &&
isEnum(value.layout, Layout);

return isValid ? value : null;
}
Expand Down

0 comments on commit 271bd79

Please sign in to comment.