diff --git a/chat/package.json b/chat/package.json index 0bbac3f2f..f49e5106a 100644 --- a/chat/package.json +++ b/chat/package.json @@ -1,6 +1,6 @@ { "name": "chat", - "version": "0.0.17", + "version": "0.0.18", "main": "./src/index.tsx", "license": "MIT", "dependencies": { diff --git a/chat/src/features/chat/UserInput.css b/chat/src/features/chat/UserInput.css index 3d8d94ab9..6b479592a 100644 --- a/chat/src/features/chat/UserInput.css +++ b/chat/src/features/chat/UserInput.css @@ -1,11 +1,17 @@ .UserInput { position: relative; + display: flex; + align-items: center; +} + +.UserInput-input { + flex: 1; + margin-right: 2rem; } .UserInput-emoji { cursor: pointer; - position: absolute; - top: 12px; - right: 12px; font-size: 20px; + transform: rotateY(180deg); + margin-right: 1rem; } \ No newline at end of file diff --git a/chat/src/features/chat/UserInput.tsx b/chat/src/features/chat/UserInput.tsx index ebccbd0ea..7e6e8b3c4 100644 --- a/chat/src/features/chat/UserInput.tsx +++ b/chat/src/features/chat/UserInput.tsx @@ -12,7 +12,7 @@ import { EmojiDrawer, QuickEmojis } from "../emoji"; import "./UserInput.css"; export function UserInput() { - const { messages, draft, sendMessage, updateDraft } = useChat(); + const { draft, sendMessage, updateDraft } = useChat(); const { reveal, hide, open } = useDrawer(); const builtChatInput = useRef(null); const { visible, addQuery } = useEmojis(); @@ -53,8 +53,8 @@ export function UserInput() { }, [handleSendMessage] ); - const handleOpenEmojiDrawer = useCallback( - () => + const handleToggleEmojiDrawer = useCallback(() => { + if (open) { reveal({ title: "Select an emoji", content: ( @@ -63,13 +63,12 @@ export function UserInput() { onClose={() => builtChatInput.current?.focus()} /> ), - }), - [] - ); - const handleCloseEmojiDrawer = useCallback(() => { - builtChatInput.current?.focus(); - hide(); - }, [hide]); + }); + } else { + builtChatInput.current?.focus(); + hide(); + } + }, [open]); const handleSelectEmoji = useCallback((emoji: string) => { updateDraft((prev) => `${prev} :${emoji}: `); }, []); @@ -108,7 +107,7 @@ export function UserInput() {