From 1a26427373b48fdb5398d9d70f65ec3e38bbde8b Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Wed, 17 Sep 2025 21:53:41 +0530 Subject: [PATCH] add new arrow to bubble message --- src/app/components/message/layout/Bubble.tsx | 41 +++++++++++++---- .../components/message/layout/layout.css.ts | 46 ++++++------------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/src/app/components/message/layout/Bubble.tsx b/src/app/components/message/layout/Bubble.tsx index 267bda04..0249d4e0 100644 --- a/src/app/components/message/layout/Bubble.tsx +++ b/src/app/components/message/layout/Bubble.tsx @@ -1,17 +1,41 @@ import React, { ReactNode } from 'react'; import classNames from 'classnames'; -import { Box, as } from 'folds'; +import { Box, ContainerColor as TContainerColor, as, color } from 'folds'; import * as css from './layout.css'; +import { ContainerColor } from '../../../styles/ContainerColor.css'; + +type BubbleArrowProps = { + variant: TContainerColor; +}; +function BubbleLeftArrow({ variant }: BubbleArrowProps) { + return ( + + + + ); +} type BubbleLayoutProps = { - self?: boolean; hideBubble?: boolean; before?: ReactNode; + header?: ReactNode; }; export const BubbleLayout = as<'div', BubbleLayoutProps>( - ({ self, hideBubble, before, children, ...props }, ref) => ( - + ({ hideBubble, before, header, children, ...props }, ref) => ( + {before} @@ -19,15 +43,12 @@ export const BubbleLayout = as<'div', BubbleLayoutProps>( className={ hideBubble ? undefined - : classNames( - css.BubbleContent, - before ? css.BubbleContentArrow : undefined, - before && self ? css.BubbleContentArrowRight : undefined, - before && !self ? css.BubbleContentArrowLeft : undefined - ) + : classNames(css.BubbleContent, before ? css.BubbleContentArrowLeft : undefined) } direction="Column" > + {!hideBubble && before ? : null} + {header} {children} diff --git a/src/app/components/message/layout/layout.css.ts b/src/app/components/message/layout/layout.css.ts index db7b8795..cb99713f 100644 --- a/src/app/components/message/layout/layout.css.ts +++ b/src/app/components/message/layout/layout.css.ts @@ -133,12 +133,10 @@ export const ModernBefore = style({ minWidth: toRem(36), }); -export const BubbleBefore = style([ - ModernBefore, - { - minWidth: toRem(24), - }, -]); +export const BubbleBefore = style({ + minWidth: toRem(24), + marginLeft: config.space.S300, +}); export const BubbleContent = style({ maxWidth: toRem(800), @@ -149,36 +147,18 @@ export const BubbleContent = style({ position: 'relative', }); -export const BubbleContentArrow = style({ - selectors: { - '&::before': { - content: '', - display: 'inline-block', - background: 'inherit', - width: toRem(8), - height: toRem(8), - position: 'absolute', - top: toRem(12.5), - zIndex: 1, - transform: 'rotateZ(45deg)', - }, - }, -}); - export const BubbleContentArrowLeft = style({ - selectors: { - '&::before': { - left: toRem(-4), - }, - }, + borderTopLeftRadius: 0, }); -export const BubbleContentArrowRight = style({ - selectors: { - '&::before': { - right: toRem(-4), - }, - }, +export const BubbleLeftArrow = style({ + width: toRem(9), + height: toRem(8), + + position: 'absolute', + top: 0, + left: toRem(-8), + zIndex: 1, }); export const Username = style({