Skip to content

Commit

Permalink
feat: add video microdata to header block (#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
qradle-yndx authored Feb 11, 2025
1 parent 447c37e commit e649755
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/blocks/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {useTheme} from '../../context/theme';
import {Col, Grid, Row} from '../../grid';
import {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';
import {block, getThemedValue} from '../../utils';
import {mergeVideoMicrodata} from '../../utils/microdata';

import {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';

Expand Down Expand Up @@ -97,6 +98,10 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
const backgroundThemed = background && getThemedValue(background, theme);
const imageThemed = image && getThemedValue(image, theme);
const videoThemed = video && getThemedValue(video, theme);
const mediaWithMicrodata = mergeVideoMicrodata(videoThemed, {
name: title,
description,
});
const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;
const titleId = useUniqId();

Expand Down Expand Up @@ -184,7 +189,7 @@ export const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>
className={b('media', {[curImageSize]: true})}
videoClassName={b('video')}
imageClassName={b('image')}
video={videoThemed}
{...mediaWithMicrodata}
image={imageThemed}
/>
)}
Expand Down

0 comments on commit e649755

Please sign in to comment.