2
0
Files
bot/packages/deprecated/bot-engine/src/components/avatars/Avatar.tsx
Baptiste Arnaud 5e019bbb22 Introducing The Forge (#1072)
The Forge allows anyone to easily create their own Typebot Block.

Closes #380
2023-12-13 10:22:02 +01:00

25 lines
712 B
TypeScript

import React, { useState } from 'react'
import { isDefined } from '@typebot.io/lib'
import { DefaultAvatar } from './DefaultAvatar'
export const Avatar = ({ avatarSrc }: { avatarSrc?: string }) => {
const [currentAvatarSrc] = useState(avatarSrc)
if (currentAvatarSrc === '') return <></>
if (isDefined(currentAvatarSrc))
return (
<figure
className={
'flex justify-center items-center rounded-full text-white w-6 h-6 text-sm relative xs:w-10 xs:h-10 xs:text-xl'
}
>
<img
src={currentAvatarSrc}
alt="Bot avatar"
className="rounded-full object-cover w-full h-full"
/>
</figure>
)
return <DefaultAvatar />
}