Files
formbricks/packages/lib/utils/styling.ts
Dhruwang Jariwala dfe025ab8e chore: Freeze client api + api docs (#4373)
Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com>
2024-12-06 12:34:30 +00:00

22 lines
665 B
TypeScript

import { TJsEnvironmentStateProject, TJsEnvironmentStateSurvey } from "@formbricks/types/js";
export const getStyling = (project: TJsEnvironmentStateProject, survey: TJsEnvironmentStateSurvey) => {
// allow style overwrite is disabled from the project
if (!project.styling.allowStyleOverwrite) {
return project.styling;
}
// allow style overwrite is enabled from the project
if (project.styling.allowStyleOverwrite) {
// survey style overwrite is disabled
if (!survey.styling?.overwriteThemeStyling) {
return project.styling;
}
// survey style overwrite is enabled
return survey.styling;
}
return project.styling;
};