2
0
Files
bot/packages/bot-engine/src/services/theme.ts
2022-01-24 09:36:28 +01:00

26 lines
722 B
TypeScript

import { BackgroundType, Theme } from 'models'
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,
background.type === BackgroundType.NONE ? 'transparent' : background.content
)
documentStyle.setProperty(cssVariableNames.container.fontFamily, font)
}