worked on chat styling
This commit is contained in:
@@ -30,7 +30,6 @@ export default function ChatContainer(props: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Chat</h1>
|
|
||||||
<Spin spinning={loading} indicator={spinIcon} />
|
<Spin spinning={loading} indicator={spinIcon} />
|
||||||
<Virtuoso
|
<Virtuoso
|
||||||
style={{ height: '80vh' }}
|
style={{ height: '80vh' }}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
.root {
|
.root {
|
||||||
height: 2rem;
|
padding: .3rem;
|
||||||
color: var(--black);
|
color: var(--text-secondry);
|
||||||
|
div[role=textbox] {
|
||||||
|
padding: .6rem;
|
||||||
|
border-radius: .35rem;
|
||||||
|
background-color: var(--color-owncast-gray-700);
|
||||||
|
& > p {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ import EmojiPicker from './EmojiPicker';
|
|||||||
import WebsocketService from '../../../services/websocket-service';
|
import WebsocketService from '../../../services/websocket-service';
|
||||||
import { websocketServiceAtom } from '../../stores/ClientConfigStore';
|
import { websocketServiceAtom } from '../../stores/ClientConfigStore';
|
||||||
import { MessageType } from '../../../interfaces/socket-events';
|
import { MessageType } from '../../../interfaces/socket-events';
|
||||||
|
import s from './ChatTextField.module.scss';
|
||||||
|
|
||||||
type CustomElement = { type: 'paragraph'; children: CustomText[] };
|
type CustomElement = { type: 'paragraph' | 'span'; children: CustomText[] };
|
||||||
type CustomText = { text: string };
|
type CustomText = { text: string };
|
||||||
|
|
||||||
declare module 'slate' {
|
declare module 'slate' {
|
||||||
@@ -103,6 +104,16 @@ export default function ChatTextField(props: Props) {
|
|||||||
const [editor] = useState(() => withImages(withReact(createEditor())));
|
const [editor] = useState(() => withImages(withReact(createEditor())));
|
||||||
|
|
||||||
const size = 'small';
|
const size = 'small';
|
||||||
|
const EMPTY_VALUE = [
|
||||||
|
{
|
||||||
|
type: 'paragraph',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
text: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const sendMessage = () => {
|
const sendMessage = () => {
|
||||||
if (!websocketService) {
|
if (!websocketService) {
|
||||||
@@ -142,12 +153,16 @@ export default function ChatTextField(props: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={s.root}>
|
||||||
<Slate editor={editor} value={[]} onChange={handleChange}>
|
<Slate
|
||||||
|
editor={editor}
|
||||||
|
value={[{ type: 'span', children: [{ text: 'hey' }] }]}
|
||||||
|
onChange={handleChange}
|
||||||
|
>
|
||||||
<Editable
|
<Editable
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
renderElement={p => <Element {...p} />}
|
renderElement={p => <Element {...p} />}
|
||||||
placeholder="Chat message goes here..."
|
// placeholder="Chat message goes here..."
|
||||||
/>
|
/>
|
||||||
</Slate>
|
</Slate>
|
||||||
<Button type="default" ghost title="Emoji" onClick={() => setShowEmojis(!showEmojis)}>
|
<Button type="default" ghost title="Emoji" onClick={() => setShowEmojis(!showEmojis)}>
|
||||||
|
|||||||
@@ -7,8 +7,25 @@
|
|||||||
.root {
|
.root {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: var(--header-h);
|
top: var(--header-h);
|
||||||
display: flex;
|
display: block;
|
||||||
min-width: 300px !important;
|
|
||||||
max-height: calc(100vh - var(--header-h));
|
max-height: calc(100vh - var(--header-h));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
First div is .ant-layout-sider-children
|
||||||
|
Only way to target it apparently
|
||||||
|
*/
|
||||||
|
.root > div {
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column nowrap;
|
||||||
|
-moz-box-flex: 1 !important;
|
||||||
|
flex-grow: 1 !important;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatHeader {
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-color-secondry);
|
||||||
|
border-bottom: 1px solid var(--color-owncast-gray-700);
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,13 +18,16 @@ export default function Sidebar() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Sider
|
<Sider
|
||||||
className={`${s.root}`}
|
className={s.root}
|
||||||
collapsed={chatVisibility === ChatVisibilityState.Hidden}
|
collapsed={chatVisibility === ChatVisibilityState.Hidden}
|
||||||
collapsedWidth={0}
|
collapsedWidth={0}
|
||||||
width="100%"
|
width={320}
|
||||||
>
|
>
|
||||||
<ChatContainer messages={messages} state={chatState} />
|
<div className={s.chatHeader}>
|
||||||
<ChatTextField />
|
<span>stream chat</span>
|
||||||
|
</div>
|
||||||
|
<ChatContainer messages={messages} state={chatState} />
|
||||||
|
<ChatTextField />
|
||||||
</Sider>
|
</Sider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,6 @@
|
|||||||
|
|
||||||
/* Layout variables */
|
/* Layout variables */
|
||||||
--header-h: 64px;
|
--header-h: 64px;
|
||||||
--chat-w: 300px;
|
--chat-w: 320px;
|
||||||
--chat-input-h: 40.5px;
|
--chat-input-h: 40.5px;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user