Few changes to Chat input

This commit is contained in:
t1enne 2022-05-22 08:37:23 +02:00
parent e045ab605b
commit bef99afa05
2 changed files with 52 additions and 19 deletions

View file

@ -1,8 +1,13 @@
.root { .root {
position: absolute;
bottom: 0px;
width: 100%;
padding: .3rem; padding: .3rem;
color: var(--text-secondry); color: var(--text-secondry);
overflow-x: hidden;
div[role=textbox] { div[role=textbox] {
padding: .6rem; padding: .6rem;
padding-right: calc(0.6rem + 44px);
border-radius: .35rem; border-radius: .35rem;
background-color: var(--color-owncast-gray-700); background-color: var(--color-owncast-gray-700);
& > p { & > p {
@ -10,3 +15,22 @@
} }
} }
} }
.inputWrapper {
display: flex;
position: relative;
}
.emojiButton {
border: none;
margin-right: 5px;
position: absolute;
right: 0px;
top: 50%;
transform: translateY(-50%);
}
.submitButtonWrapper {
display: flex;
padding: 6px 0;
justify-content: flex-end;
}

View file

@ -144,6 +144,7 @@ export default function ChatTextField(props: Props) {
return ( return (
<div className={s.root}> <div className={s.root}>
<div className={s.inputWrapper}>
<Slate <Slate
editor={editor} editor={editor}
value={[{ type: 'paragraph', children: [{ text: '' }] }]} value={[{ type: 'paragraph', children: [{ text: '' }] }]}
@ -152,17 +153,25 @@ export default function ChatTextField(props: Props) {
<Editable <Editable
onKeyDown={onKeyDown} onKeyDown={onKeyDown}
renderElement={p => <Element {...p} />} renderElement={p => <Element {...p} />}
// placeholder="Chat message goes here..." placeholder="Chat message goes here..."
style={{ width: '100%' }}
/> />
</Slate> </Slate>
<Button type="default" ghost title="Emoji" onClick={() => setShowEmojis(!showEmojis)}> <Button
<SmileOutlined style={{ color: 'rgba(0,0,0,.45)' }} /> className={s.emojiButton}
type="default"
ghost
title="Emoji"
onClick={() => setShowEmojis(!showEmojis)}
>
<SmileOutlined />
</Button> </Button>
</div>
<div className={s.submitButtonWrapper}>
<Button size={size} type="primary" onClick={sendMessage}> <Button size={size} type="primary" onClick={sendMessage}>
Submit Submit
</Button> </Button>
</div>
<Popover <Popover
content={<EmojiPicker onEmojiSelect={handleEmojiSelect} />} content={<EmojiPicker onEmojiSelect={handleEmojiSelect} />}
trigger="click" trigger="click"