Skip to content

Commit

Permalink
RichBubble의 items prop을 blocks로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
guswl98 committed Nov 9, 2023
1 parent 63b2417 commit 774b5d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions packages/chat/src/bubble/rich.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Button = styled.a`

export function RichBubble({
my,
items, // bubbleStyle,
blocks,
cloudinaryName,
mediaUrlBase,
onImageClick,
Expand All @@ -53,16 +53,16 @@ export function RichBubble({
css={{ margin: my ? '0 0 0 8px' : undefined, size: textBubbleFontSize }}
{...props}
>
{items.map((item, index) => {
switch (item.type) {
{blocks.map((block, index) => {
switch (block.type) {
case 'text':
return <TextItem text={item.message} css={textItemStyle} />
return <TextItem text={block.message} css={textItemStyle} />
case 'images': {
if (item.images.length === 0) {
if (block.images.length === 0) {
return null
}
const imageUrl = generatePreviewImage({
imageInfo: item.images[0],
imageInfo: block.images[0],
cloudinaryName,
mediaUrlBase,
})
Expand All @@ -71,7 +71,7 @@ export function RichBubble({
key={index}
src={imageUrl}
onClick={() => {
onImageClick?.(item.images)
onImageClick?.(block.images)
}}
css={imageItemStyle}
/>
Expand All @@ -81,11 +81,11 @@ export function RichBubble({
return (
<Button
key={index}
href={item.action.param}
href={block.action.param}
onClick={onButtonBeforeRouting}
css={buttonItemStyle}
>
{item.label}
{block.label}
</Button>
)
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/chat/src/bubble/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export type TextBubbleProp = {

export type RichBubbleProp = {
my: boolean
items: (RichItemText | RichItemImages | RichItemButton)[]
blocks: (RichItemText | RichItemImages | RichItemButton)[]
cloudinaryName: string
mediaUrlBase: string
onImageClick?: (imageInfos: MetaDataInterface[]) => void
Expand Down
2 changes: 1 addition & 1 deletion packages/chat/src/chat/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function getBubbleProp({
id: messageId,
my,
maxWidthOffset: 100,
items: messagePayload.items,
blocks: messagePayload.items,
mediaUrlBase:
process.env.NEXT_PUBLIC_MEDIA_URL_BASE ||
'https://media.triple.guide',
Expand Down

0 comments on commit 774b5d4

Please sign in to comment.