🦴 Add theme page backbone
This commit is contained in:
25
packages/bot-engine/src/services/theme.ts
Normal file
25
packages/bot-engine/src/services/theme.ts
Normal file
@ -0,0 +1,25 @@
|
||||
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.content
|
||||
)
|
||||
documentStyle.setProperty(cssVariableNames.container.fontFamily, font)
|
||||
}
|
Reference in New Issue
Block a user