Skip to content

Commit

Permalink
fix(lib): 💄 Proactive message close icon
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 18, 2022
1 parent 0beb2e6 commit ac278b9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/typebot-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typebot-js",
"version": "2.2.6",
"version": "2.2.7",
"main": "dist/index.js",
"unpkg": "dist/index.umd.min.js",
"license": "AGPL-3.0-or-later",
Expand Down
5 changes: 3 additions & 2 deletions packages/typebot-js/src/embedTypes/chat/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const createButton = (params?: ButtonParams): HTMLButtonElement => {
button.id = 'typebot-bubble-button'
button.style.backgroundColor = params?.color ?? '#0042DA'
button.appendChild(createButtonIcon(params?.iconUrl, params?.iconStyle))
button.appendChild(createCloseIcon())
button.appendChild(createCloseIcon(params?.closeIconColor))
return button
}

Expand All @@ -29,11 +29,12 @@ const createDefaultIcon = (): SVGElement => {
return icon
}

const createCloseIcon = (): SVGElement => {
const createCloseIcon = (closeIconColor?: string): SVGElement => {
const icon = document.createElementNS('http://www.w3.org/2000/svg', 'svg')
icon.setAttribute('viewBox', '0 0 24 24')
icon.innerHTML = closeSvgPath
icon.classList.add('close-icon')
icon.style.stroke = closeIconColor ?? '#ffffff'
return icon
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const createTextElement = (text: string): HTMLParagraphElement => {
const createCloseButton = (bubble: HTMLDivElement): HTMLButtonElement => {
const button = document.createElement('button')
button.classList.add('close-button')
button.innerHTML = `<svg viewBox="0 0 512 512">${closeSvgPath}</svg>`
button.innerHTML = `<svg viewBox="0 0 24 24" style="stroke:black; stroke-width:2px; margin:4px">${closeSvgPath}</svg>`
button.addEventListener('click', (e) => onCloseButtonClick(e, bubble))
return button
}
Expand Down
1 change: 1 addition & 0 deletions packages/typebot-js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type ButtonParams = {
color?: string
iconUrl?: string
iconStyle?: string
closeIconColor?: string
}

export type ProactiveMessageParams = {
Expand Down

4 comments on commit ac278b9

@vercel
Copy link

@vercel vercel bot commented on ac278b9 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ac278b9 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on ac278b9 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.