Skip to content

Commit 182b1ce

Browse files
authored
feat: remove default YandexForm theme (#1153)
1 parent 0c01ae6 commit 182b1ce

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/YandexForm/YandexForm.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {YandexFormProps} from '../../models';
77
import {DefaultEventNames} from '../../models/common';
88
import {block} from '../../utils';
99
import {HEADER_HEIGHT} from '../constants';
10+
import {ProjectSettingsContext} from '../../context/projectSettingsContext';
1011

1112
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
1213
export const YANDEX_FORM_SECTION = 'surveys';
@@ -36,11 +37,13 @@ const YandexForm = (props: YandexFormProps) => {
3637
const handleAnalytics = useAnalytics(DefaultEventNames.YandexFormSubmit);
3738
const isMobile = React.useContext(MobileContext);
3839
const locale = React.useContext(LocaleContext);
40+
const {defaultYandexFormTheme} = React.useContext(ProjectSettingsContext);
3941

4042
const updateFormIframe = React.useCallback(
4143
(container: HTMLDivElement) => {
4244
const queryParams = new URLSearchParams(location.search);
4345
const url = location.origin + location.pathname;
46+
const formTheme = theme || defaultYandexFormTheme;
4447

4548
queryParams.set('url', url);
4649
queryParams.set('iframe', '1');
@@ -49,7 +52,9 @@ const YandexForm = (props: YandexFormProps) => {
4952
queryParams.set('lang', locale.lang);
5053
}
5154

52-
queryParams.set('theme', theme || 'cloud-www');
55+
if (formTheme) {
56+
queryParams.set('theme', formTheme);
57+
}
5358

5459
if (isMobile) {
5560
queryParams.set('media-type', 'mobile');

src/context/projectSettingsContext/ProjectSettingsContext.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface ProjectSettingsContextProps {
33
disableCompress?: boolean;
44
isAnimationEnabled?: boolean;
55
renderInvisibleBlocks?: boolean;
6+
defaultYandexFormTheme?: string;
67
}
78

89
export const ProjectSettingsContext = React.createContext<ProjectSettingsContextProps>({});

0 commit comments

Comments
 (0)