Skip to content

Commit

Permalink
⚡ (embed) Add customizable bubble close icon
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Jul 25, 2023
1 parent b171b39 commit c8bc659
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.1.6",
"version": "0.1.7",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",
Expand Down
88 changes: 64 additions & 24 deletions packages/embeds/js/src/features/bubble/components/BubbleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export const BubbleButton = (props: Props) => (
(isSvgSrc(props.customIconSrc) ? '' : ' object-cover rounded-full')
}
alt="Bubble button icon"
elementtiming={'Bubble button icon'}
fetchpriority={'high'}
/>
</Show>
<Show when={props.customIconSrc && !isImageSrc(props.customIconSrc)}>
Expand All @@ -84,29 +82,71 @@ export const BubbleButton = (props: Props) => (
{props.customIconSrc}
</span>
</Show>

<svg
viewBox="0 0 24 24"
style={{
fill:
props.iconColor ??
(isLight(props.backgroundColor ?? defaultButtonColor)
? defaultDarkIconColor
: defaultLightIconColor),
}}
class={
`absolute duration-200 transition ` +
(props.isBotOpened
? 'scale-100 rotate-0 opacity-100'
: 'scale-0 -rotate-180 opacity-0') +
(props.size === 'large' ? ' w-9' : ' w-7')
}
<Show when={isNotDefined(props.customCloseIconSrc)}>
<svg
viewBox="0 0 24 24"
style={{
fill:
props.iconColor ??
(isLight(props.backgroundColor ?? defaultButtonColor)
? defaultDarkIconColor
: defaultLightIconColor),
}}
class={
`absolute duration-200 transition ` +
(props.isBotOpened
? 'scale-100 rotate-0 opacity-100'
: 'scale-0 -rotate-180 opacity-0') +
(props.size === 'large' ? ' w-9' : ' w-7')
}
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M18.601 8.39897C18.269 8.06702 17.7309 8.06702 17.3989 8.39897L12 13.7979L6.60099 8.39897C6.26904 8.06702 5.73086 8.06702 5.39891 8.39897C5.06696 8.73091 5.06696 9.2691 5.39891 9.60105L11.3989 15.601C11.7309 15.933 12.269 15.933 12.601 15.601L18.601 9.60105C18.9329 9.2691 18.9329 8.73091 18.601 8.39897Z"
/>
</svg>
</Show>
<Show
when={props.customCloseIconSrc && isImageSrc(props.customCloseIconSrc)}
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M18.601 8.39897C18.269 8.06702 17.7309 8.06702 17.3989 8.39897L12 13.7979L6.60099 8.39897C6.26904 8.06702 5.73086 8.06702 5.39891 8.39897C5.06696 8.73091 5.06696 9.2691 5.39891 9.60105L11.3989 15.601C11.7309 15.933 12.269 15.933 12.601 15.601L18.601 9.60105C18.9329 9.2691 18.9329 8.73091 18.601 8.39897Z"
<img
part="button-icon"
src={props.customCloseIconSrc}
class={
'duration-200 transition' +
(props.isBotOpened
? 'scale-100 rotate-0 opacity-100'
: 'scale-0 -rotate-180 opacity-0') +
(isSvgSrc(props.customCloseIconSrc)
? props.size === 'large'
? ' w-9 h-9'
: ' w-7 h-7'
: ' w-[90%] h-[90%]') +
(isSvgSrc(props.customCloseIconSrc)
? ''
: ' object-cover rounded-full')
}
alt="Bubble button clost icon"
/>
</svg>
</Show>
<Show
when={props.customCloseIconSrc && !isImageSrc(props.customCloseIconSrc)}
>
<span
class={
'text-4xl duration-200 transition' +
(props.isBotOpened
? 'scale-100 rotate-0 opacity-100'
: 'scale-0 -rotate-180 opacity-0')
}
style={{
'font-family':
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'",
}}
>
{props.customCloseIconSrc}
</span>
</Show>
</button>
)
1 change: 1 addition & 0 deletions packages/embeds/js/src/features/bubble/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type ButtonTheme = {
backgroundColor?: string
iconColor?: string
customIconSrc?: string
customCloseIconSrc?: string
}

export type PreviewMessageParams = {
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.1.6",
"version": "0.1.7",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.1.6",
"version": "0.1.7",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

3 comments on commit c8bc659

@vercel
Copy link

@vercel vercel bot commented on c8bc659 Jul 25, 2023

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:

docs – ./apps/docs

docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on c8bc659 Jul 25, 2023

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 c8bc659 Jul 25, 2023

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:

viewer-v2 – ./apps/viewer

bii.bj
1stop.au
wasap.nl
x.cr8.ai
amostra-safe.click
andreimayer.com.br
bebesemcolicas.com
bot.danyservice.it
bot.iconicbrows.it
bot.lucide.contact
bot.neferlopez.com
bot.samplehunt.com
bot.sinalcerto.com
bot.wphelpchat.com
bots.robomotion.io
cadu.uninta.edu.br
chat.hand-made.one
chat.tuanpakya.com
chat.webisharp.com
chatbotforthat.com
descobrindotudo.me
dicanatural.online
digitalhelp.com.au
draraquelnutri.com
drcarlosyoshi.site
goalsettingbot.com
leads.gecoelho.com
noticiasnet.online
novoappespiao.site
omarcodosanjos.com
pant.maxbot.com.br
pantherview.cr8.ai
positivobra.com.br
rollingball.cr8.ai
speciallife.com.br
sub.yolozeeeer.com
survey.digienge.io
zap.techadviser.in
ai.digitaldaftar.in
app.danielnalex.com
ask.realversity.org
bot.boston-voip.com
bot.cabinpromos.com
bot.carnaval.studio
bot.digitalbled.com
bot.dsignagency.com
bot.enthrallart.com
bot.eventhub.com.au
bot.gravityatoms.in
bot.jepierre.com.br
bot.leadgenpod.site
bot.ltmidias.com.br
form.searchcube.com.sg
gcase.barrettamario.it
go.orodrigoribeiro.com
help.giversforgood.com
info.clickasuransi.com
kodawariab736.skeep.it
mdb.diego.progenbr.com
michaeljackson.riku.ai
premium.kandabrand.com
psicologiacognitiva.co
report.gratirabbit.com
resume.gratirabbit.com
teambuilding.hidden.sg
whatsappwebsite.com.br
whatsappwebsite.online
83242573.actualizar.xyz
87656003.actualizar.xyz
88152257.actualizar.xyz
91375310.actualizar.xyz
app.youvisitedthis.site
arrivalx2.wpwakanda.com
bot.blackboxtips.com.br
bot.chat-digital.online
bot.hotelplayarimini.it
bot.messengerbet.online
chat.bebesemcolicas.com
detetivealessandra.site
emprestimo.ocred.net.br
filial.socialcliques.me
help.comebackreward.com
link.despigmenta.com.br
link.venturasuceder.com
mainmenu.diddancing.com
manualhandlingcourse.ie
mdb.baleia.progenbr.com
mdb.equipe.progenbr.com
mdb.evento.progenbr.com
prebook.enthrallart.com
primitive-shapes.cr8.ai
register.kandabrand.com
sell.sellitwithgary.com
signup.hypemarketing.in
sistemacanadense.online
subfooter.wpwakanda.com
survey.hypemarketing.in
testbot.afterorigin.com
tigerfull.amzooline.com
typebot.influencer.love

Please sign in to comment.