-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathstudent.component.tsx
More file actions
81 lines (73 loc) · 2.14 KB
/
student.component.tsx
File metadata and controls
81 lines (73 loc) · 2.14 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';
import Typography from '@material-ui/core/Typography';
import Checkbox from '@material-ui/core/Checkbox';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import * as innerClasses from './student.styles';
import { useAutoScroll } from 'common/hooks/auto-scroll.hook';
import { handleDownloadSessionContent } from 'common';
import GetAppIcon from '@material-ui/icons/GetApp';
import Button from '@material-ui/core/Button';
interface Props {
room: string;
log: string;
}
export const StudentComponent: React.FC<Props> = props => {
const { room, log } = props;
const {
isAutoScrollEnabled,
setIsAutoScrollEnabled,
textAreaRef,
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>
<TextareaAutosize
ref={textAreaRef}
id="session"
rowsMax={30}
rowsMin={30}
className={innerClasses.textarea}
value={log ?? ''}
/>
<div className={innerClasses.buttonScroll}>
<Button
variant="contained"
color="primary"
disableElevation
className={innerClasses.downloadButton}
onClick={() => handleDownloadSessionContent(log)}
>
<GetAppIcon className={innerClasses.downloadIcon} />
Download
</Button>
<FormControlLabel
label="Enable AutoScroll"
className="scroll"
control={
<Checkbox
checked={isAutoScrollEnabled}
onChange={e => setIsAutoScrollEnabled(e.target.checked)}
color="primary"
/>
}
/>
</div>
</main>
</>
);
};