diff --git a/packages/react/src/views/ChatInput/ChatInput.styles.js b/packages/react/src/views/ChatInput/ChatInput.styles.js index 84ff9cacb..2f8718b19 100644 --- a/packages/react/src/views/ChatInput/ChatInput.styles.js +++ b/packages/react/src/views/ChatInput/ChatInput.styles.js @@ -4,9 +4,10 @@ import { darken, lighten } from '@embeddedchat/ui-elements'; export const getChatInputStyles = (theme) => { const styles = { inputWithFormattingBox: css` + width: 100%; + margin-bottom: 5px; border: 1px solid ${theme.colors.border}; border-radius: ${theme.radius}; - margin: 0.5rem 2rem 1rem 2rem; &.focused { border: ${`1.5px solid ${theme.colors.ring}`}; } @@ -39,7 +40,6 @@ export const getChatInputStyles = (theme) => { border: none; outline: none; font-size: 14px; - &:focus { border: none; outline: none; @@ -81,13 +81,24 @@ export const getChatInputFormattingToolbarStyles = ({ theme, mode }) => { `, popOverStyles: css` position: absolute; - bottom: 4rem; + bottom: 3rem; left: 0; - border: 1px solid ${theme.colors.border}; - z-index: 1000; - background-color: ${theme.colors.background}; - border-radius: 4px; + width: 100%; + background: ${theme.colors.background}; + box-shadow: 0 -8px 10px ${mode === 'light' ? darken(theme.colors.background, 0.1) : lighten(theme.colors.background, 1)}; + border-radius: 8px; padding: 1rem; + display: flex; + flex-direction: column; + align-items: flex-start; + z-index: 100; + `, + popOverItemStyles: css` + display: flex; + gap: 0.5rem; + align-items: center; + cursor: pointer; + padding: 0.5rem; `, }; return styles; diff --git a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js index aecd888bf..67b53ab12 100644 --- a/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js +++ b/packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js @@ -42,6 +42,7 @@ const ChatInputFormattingToolbar = ({ const [isEmojiOpen, setEmojiOpen] = useState(false); const [isPopoverOpen, setPopoverOpen] = useState(false); const popoverRef = useRef(null); + useEffect(() => { const handleClickOutside = (event) => { if (popoverRef.current && !popoverRef.current.contains(event.target)) { @@ -68,11 +69,6 @@ const ChatInputFormattingToolbar = ({ triggerButton?.(null, message); }; - const handleFormatterClick = (item) => { - formatSelection(messageRef, item.pattern); - setPopoverOpen(false); - }; - const chatToolMap = { audio: ( @@ -80,27 +76,29 @@ const ChatInputFormattingToolbar = ({ ), video: ( - {}} - > + - + ), file: ( - - - + + + + + ), }; + const handleFormatterClick = (item) => { + formatSelection(messageRef, item.pattern); + setPopoverOpen(false); + }; + return ( { - setEmojiOpen(true); - }} + onClick={() => setEmojiOpen(true)} > @@ -123,7 +119,7 @@ const ChatInputFormattingToolbar = ({ { - formatSelection(messageRef, item.pattern); - }} + onClick={() => formatSelection(messageRef, item.pattern)} > ))} - - {['audio', 'file', 'video'].map((key) => chatToolMap[key])} formatter.find((item) => item.name === name)) .map((item) => ( - handleFormatterClick(item)} - css={css` - padding: 8px; - cursor: pointer; - `} + css={styles.popOverItemStyles} > - + {item.name} + ))} - {['video', 'file'].map((key) => ( - - {chatToolMap[key]} - - ))} )} - {surfaceItems.includes('audio') && chatToolMap.audio} + {surfaceItems.map((key) => chatToolMap[key])} {isEmojiOpen && ( { const styles = { messageContainer: css` - margin: 0.2rem 2rem; position: relative; font-size: 0.85rem; background-color: ${theme.colors.background}; @@ -12,7 +11,7 @@ const getQuoteMessageStyles = (theme) => { z-index: 1200; border: 1px solid ${theme.colors.border}; border-radius: ${theme.radius}; - max-width: 100%; + width: 100%; box-sizing: border-box; `,