2
0

(theme) Support for image background

Closes #414
This commit is contained in:
Baptiste Arnaud
2023-03-22 14:45:10 +01:00
parent 1cf2195b4a
commit 3992227afc
6 changed files with 77 additions and 19 deletions

View File

@ -137,8 +137,17 @@ const setTypebotBackground = (
background?.type === BackgroundType.IMAGE
? cssVariableNames.general.bgImage
: cssVariableNames.general.bgColor,
background.type === BackgroundType.NONE
? 'transparent'
: background.content ?? '#ffffff'
parseBackgroundValue(background)
)
}
const parseBackgroundValue = ({ type, content }: Background) => {
switch (type) {
case BackgroundType.NONE:
return 'transparent'
case BackgroundType.COLOR:
return content ?? '#ffffff'
case BackgroundType.IMAGE:
return `url(${content})`
}
}