Skip to content

Commit fb80d05

Browse files
committed
hide chat by default
1 parent 8458c3e commit fb80d05

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

demo-react/src/App.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ function SessionPage(props: SessionPageProps) {
186186
const localStreams = useStore(peerStore.$streams);
187187
const remotePeersMap = useStore(peerStore.$remotePeers);
188188
const [muted, setMuted] = useState(true);
189-
const [hideChat, setHideChat] = useState(false);
189+
const [hideChat, setHideChat] = useState(true);
190190
const [screenShare, setScreenShare] = useState(false);
191191
const state = useStore(peerStore.$state);
192192

@@ -254,7 +254,7 @@ function SessionPage(props: SessionPageProps) {
254254
</a>
255255
</nav>
256256

257-
<ChatDialog hidden={hideChat} />
257+
<ChatDialog hidden={hideChat} onClose={() => setHideChat(true)} />
258258

259259
<main
260260
className="grid responsive no-padding space"
@@ -294,6 +294,7 @@ function SessionPage(props: SessionPageProps) {
294294

295295
interface ChatDialogProps {
296296
hidden: boolean;
297+
onClose: () => void;
297298
}
298299

299300
function ChatDialog(props: ChatDialogProps) {
@@ -313,8 +314,13 @@ function ChatDialog(props: ChatDialogProps) {
313314
};
314315

315316
return (
316-
<dialog className={`right vertical ${props.hidden || "active"}`}>
317-
<h5>Chat</h5>
317+
<dialog className={`right overlay vertical ${props.hidden || "active"}`}>
318+
<nav>
319+
<button className="transparent circle" onClick={props.onClose}>
320+
<i>close</i>
321+
</button>
322+
<h5>Chat</h5>
323+
</nav>
318324

319325
<nav className="vertical scroll" style={{ height: "100%" }}>
320326
{sortedHistory.map(([key, text]) => {
@@ -339,7 +345,11 @@ function ChatDialog(props: ChatDialogProps) {
339345

340346
<nav>
341347
<form className="field round fill row" onSubmit={onSubmit}>
342-
<input onChange={(e) => setText(e.target.value)} value={text} />
348+
<input
349+
onChange={(e) =>
350+
setText(e.target.value)}
351+
value={text}
352+
/>
343353
<button
344354
type="submit"
345355
className="transparent circle"

0 commit comments

Comments
 (0)