From 4729aca6b0adebf2d81196d9e600b135ceb7c658 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Tue, 23 Apr 2024 22:56:05 -0700 Subject: [PATCH] ReplyTo: improve bubble --- .../components/composer/BubbleReplyTo.tsx | 49 ++++++++++++------- .../chat/components/composer/Composer.tsx | 6 +-- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/apps/chat/components/composer/BubbleReplyTo.tsx b/src/apps/chat/components/composer/BubbleReplyTo.tsx index 79eb2971d..bd7b6f301 100644 --- a/src/apps/chat/components/composer/BubbleReplyTo.tsx +++ b/src/apps/chat/components/composer/BubbleReplyTo.tsx @@ -1,38 +1,53 @@ import * as React from 'react'; +import type { SxProps } from '@mui/joy/styles/types'; import { Box, IconButton, Tooltip, Typography } from '@mui/joy'; - -import ReplyRoundedIcon from '@mui/icons-material/ReplyRounded'; import CloseRoundedIcon from '@mui/icons-material/CloseRounded'; +import ReplyRoundedIcon from '@mui/icons-material/ReplyRounded'; -export function BubbleReplyTo(props: { replyToText: string | null, onClick: () => void }) { +const bubbleComposerSx: SxProps = { + // contained + width: '100%', + zIndex: 2, // stays on top of the 'tokens' bubble in the composer + + // style + backgroundColor: 'background.surface', + border: '1px solid', + borderColor: 'neutral.outlinedBorder', + borderRadius: 'sm', + boxShadow: 'xs', + padding: '0.5rem 0.25rem 0.5rem 0.5rem', + + // layout + display: 'flex', + alignItems: 'start', +}; + + +export function BubbleReplyTo(props: { + replyToText: string | null, + onClear: () => void + className?: string, +}) { return ( - + - + {props.replyToText} - + diff --git a/src/apps/chat/components/composer/Composer.tsx b/src/apps/chat/components/composer/Composer.tsx index bf715bf1c..e0e668874 100644 --- a/src/apps/chat/components/composer/Composer.tsx +++ b/src/apps/chat/components/composer/Composer.tsx @@ -630,9 +630,6 @@ export function Composer(props: { minWidth: 200, // flex: enable X-scrolling (resetting any possible minWidth due to the attachments) }}> - {/* Reply-to */} - {!!replyToText && } - {/* Textarea + Mic buttons + Mic/Drag overlay */} @@ -654,6 +651,7 @@ export function Composer(props: { onPasteCapture={handleAttachCtrlV} // onFocusCapture={handleFocusModeOn} // onBlurCapture={handleFocusModeOff} + endDecorator={showReplyTo && } slotProps={{ textarea: { enterKeyHint: enterIsNewline ? 'enter' : 'send', @@ -666,7 +664,7 @@ export function Composer(props: { }} sx={{ backgroundColor: 'background.level1', - '&:focus-within': { backgroundColor: 'background.popup' }, + '&:focus-within': { backgroundColor: 'background.popup', '.reply-to-bubble': { backgroundColor: 'background.popup' } }, lineHeight: lineHeightTextareaMd, }} />