Files
tom goriunovandGitHub 5627820db8 Highlights banners on home page (#3175)
* basic implementation

* fix loading state of image

* tests

* try to fix flaky tests
2025-12-18 12:21:53 +01:00

25 lines
810 B
TypeScript

import { HighlightsBannerConfig } from "types/homepage";
import { urlTest } from "../../utils";
import * as yup from 'yup';
const highlightsBannerConfigSchema: yup.ObjectSchema<HighlightsBannerConfig> = yup.object({
title: yup.string().required(),
description: yup.string().required(),
title_color: yup.array().max(2).of(yup.string()),
description_color: yup.array().max(2).of(yup.string()),
background: yup.array().max(2).of(yup.string()),
side_img_url: yup.array().max(2).of(yup.string()),
is_pinned: yup.boolean(),
page_path: yup.string(),
redirect_url: yup.string().test(urlTest),
});
export const highlightsConfigSchema = yup
.object()
.shape({
NEXT_PUBLIC_HOMEPAGE_HIGHLIGHTS_CONFIG: yup
.array()
.json()
.of(highlightsBannerConfigSchema)
.min(2)
});