2
0

💄 Add backgroundColor theme field for Popup

And use it for the onboarding modal

Closes #375
This commit is contained in:
Baptiste Arnaud
2023-03-10 10:01:36 +01:00
parent 5bbb5394ba
commit 15c1432c32
5 changed files with 11 additions and 2 deletions

View File

@ -16,6 +16,7 @@ export const OnboardingModal = ({ totalTypebots }: Props) => {
'/bots/onboarding.json',
'/bots/onboarding-dark.json'
)
const backgroundColor = useColorModeValue('white', '#171923')
const { user, updateUser } = useUser()
const [typebot, setTypebot] = useState<Typebot>()
const confettiCanvaContainer = useRef<HTMLCanvasElement | null>(null)
@ -102,6 +103,9 @@ export const OnboardingModal = ({ totalTypebots }: Props) => {
prefilledVariables={{
Name: user?.name?.split(' ')[0] ?? undefined,
}}
theme={{
backgroundColor,
}}
defaultOpen={isNewUser}
onAnswer={handleNewAnswer}
onEnd={handleBotEnd}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.0.22",
"version": "0.0.23",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@ -122,6 +122,10 @@ export const Popup = (props: PopupProps) => {
<div class="flex min-h-full items-center justify-center p-4 text-center sm:p-0">
<div
class="relative h-[80vh] transform overflow-hidden rounded-lg text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg"
style={{
'background-color':
props.theme?.backgroundColor ?? 'transparent',
}}
ref={botContainer}
>
<Bot {...botProps} prefilledVariables={prefilledVariables()} />

View File

@ -2,5 +2,6 @@ export type PopupParams = {
autoShowDelay?: number
theme?: {
width?: string
backgroundColor?: string
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.0.22",
"version": "0.0.23",
"description": "React library to display typebots on your website",
"main": "dist/index.js",
"types": "dist/index.d.ts",