Skip to content

Commit

Permalink
feat: update schemas for Table and Media blocks (#628)
Browse files Browse the repository at this point in the history
* feat: added video new parameters and caption parameter to the schema
  • Loading branch information
Kyzyl-ool authored Oct 12, 2023
1 parent 2609ca9 commit b9b5fff
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/blocks/Table/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export const TableBlock = {
type: 'string',
enum: ['disk', 'tick'],
},
caption: {
type: 'string',
},
},
},
},
Expand Down
40 changes: 38 additions & 2 deletions src/schema/validators/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import {ImageProps, imageUrlPattern} from '../../components/Image/schema';
import {Theme} from '../../models';
import {
CustomControlsButtonPositioning,
CustomControlsType,
MediaVideoControlsType,
Theme,
} from '../../models';

import {AnalyticsEventSchema} from './event';
import {pixelEvents} from './pixel';
Expand All @@ -14,12 +19,21 @@ export const contentTextWidth = ['s', 'm', 'l'];
export const videoTypes = ['default', 'player'];
export const playIconTypes = ['default', 'text'];
export const playIconThemes = ['blue', 'grey'];
export const videoControlsTypes = ['default', 'custom'];
export const videoControlsTypes = [MediaVideoControlsType.Default, MediaVideoControlsType.Custom];
export const fileLinkTypes = ['vertical', 'horizontal'];

export const dividerEnum = {enum: [0, 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl']};
export const sizeNumber = {type: 'number', maximum: 12, minimum: 1};
export const contentThemes = ['default', 'dark', 'light'];
export const customControlsType = [
CustomControlsType.WithMuteButton,
CustomControlsType.WithPlayPauseButton,
];
export const customControlsButtonPositioning = [
CustomControlsButtonPositioning.Center,
CustomControlsButtonPositioning.Left,
CustomControlsButtonPositioning.Right,
];

export const BaseProps = {
type: {},
Expand Down Expand Up @@ -98,6 +112,24 @@ export const PlayButtonProps = {
},
};

export const CustomControlsOptionsProps = {
type: 'object',
additionalProperties: false,
properties: {
type: {
type: 'string',
enum: customControlsType,
},
muteButtonShown: {
type: 'boolean',
},
positioning: {
type: 'string',
enum: customControlsButtonPositioning,
},
},
};

export const VideoProps = {
type: 'object',
additionalProperties: false,
Expand Down Expand Up @@ -139,6 +171,10 @@ export const VideoProps = {
type: 'string',
enum: videoControlsTypes,
},
customControlsOptions: CustomControlsOptionsProps,
ariaLabel: {
type: 'string',
},
},
};

Expand Down

0 comments on commit b9b5fff

Please sign in to comment.