-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathstudent.component.tsx
More file actions
52 lines (47 loc) · 1.41 KB
/
student.component.tsx
File metadata and controls
52 lines (47 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import React from 'react';
import Typography from '@mui/material/Typography';
import Checkbox from '@mui/material/Checkbox';
import FormControlLabel from '@mui/material/FormControlLabel';
import { useAutoScroll } from 'common/hooks/auto-scroll.hook';
import { MarkdownViewer } from 'common/markdown-view/markdown-view';
import * as innerClasses from './student.styles';
interface Props {
room: string;
log: string;
className?: string;
}
export const StudentComponent: React.FC<Props> = (props) => {
const { room, log } = props;
const { isAutoScrollEnabled, setIsAutoScrollEnabled, doAutoScroll } =
useAutoScroll();
React.useEffect(() => {
doAutoScroll();
}, [log]);
return (
<>
<main className={innerClasses.root}>
<Typography
className={innerClasses.sessionName}
variant="body1"
role="heading"
>
Session name: {room ?? ''}
</Typography>
<label className={innerClasses.label} htmlFor="session">
Content
</label>
<MarkdownViewer value={log ?? ''} className={innerClasses.textView} />
<FormControlLabel
label="Enable AutoScroll"
control={
<Checkbox
checked={isAutoScrollEnabled}
onChange={(e) => setIsAutoScrollEnabled(e.target.checked)}
color="primary"
/>
}
/>
</main>
</>
);
};