2022-01-06 09:40:56 +01:00
|
|
|
import { BackgroundType, Theme } from 'models'
|
2021-12-23 09:37:42 +01:00
|
|
|
|
|
|
|
const cssVariableNames = {
|
|
|
|
container: {
|
|
|
|
bg: {
|
|
|
|
image: '--typebot-container-bg-image',
|
|
|
|
color: '--typebot-container-bg-color',
|
|
|
|
},
|
|
|
|
fontFamily: '--typebot-container-font-family',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
export const setCssVariablesValue = (
|
|
|
|
theme: Theme,
|
|
|
|
documentStyle: CSSStyleDeclaration
|
|
|
|
) => {
|
|
|
|
const { background, font } = theme.general
|
|
|
|
documentStyle.setProperty(
|
|
|
|
background.type === BackgroundType.IMAGE
|
|
|
|
? cssVariableNames.container.bg.image
|
|
|
|
: cssVariableNames.container.bg.color,
|
2022-01-24 09:36:28 +01:00
|
|
|
background.type === BackgroundType.NONE ? 'transparent' : background.content
|
2021-12-23 09:37:42 +01:00
|
|
|
)
|
|
|
|
documentStyle.setProperty(cssVariableNames.container.fontFamily, font)
|
|
|
|
}
|