Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hi02102002 committed Jun 24, 2024
1 parent 0164faa commit f6c4f6a
Show file tree
Hide file tree
Showing 8 changed files with 280 additions and 266 deletions.
506 changes: 253 additions & 253 deletions dist-components/index.es.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist-components/index.es.js.map

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dist-components/index.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist-components/index.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dialogue-chatbox",
"private": false,
"version": "2.0.1",
"version": "2.0.2",
"type": "module",
"main": "./dist-components/index.umd.js",
"module": "./dist-components/index.es.js",
Expand Down
12 changes: 12 additions & 0 deletions src/components/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ const Body = () => {
return <CardsMessage key={`${msg.createdAt}+${index}`} message={msg} />
}

if (msg.type === 'image') {
return (
<Message message={msg}>
<img
src={msg.url}
alt=''
className='rounded-md object-cover h-full w-full'
/>
</Message>
)
}

return <Message key={`${msg.createdAt}+${index}`} message={msg} />
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Message = ({ message, children }: Props) => {
backgroundColor: isLeft ? undefined : customStyles?.color,
}}
>
{message.message}
{message.message.trim().length ? message.message : null}
{children}
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/types/chatbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export type TMessage<T = any> = {
createdAt: string
isTest?: boolean
adminId?: string
type?: 'image' | 'text'
url?: string
}

export type TButtonsMessage = TMessage<TButton>
Expand Down

0 comments on commit f6c4f6a

Please sign in to comment.