Skip to content

Commit f95704c

Browse files
committed
moar work with chat v2
1 parent 20d862a commit f95704c

File tree

12 files changed

+274
-178
lines changed

12 files changed

+274
-178
lines changed

package-lock.json

Lines changed: 33 additions & 118 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Send } from '@mui/icons-material'
2-
import { IconButton, TextField } from '@mui/material'
2+
import { Container, IconButton, Paper, TextField } from '@mui/material'
33
import { useState } from 'react'
44

55
export const ChatBox = ({
@@ -20,26 +20,53 @@ export const ChatBox = ({
2020
}
2121

2222
return (
23-
<form onSubmit={handleSubmit}>
24-
<TextField
25-
value={message}
26-
onChange={(e) => setMessage(e.target.value)}
27-
placeholder="Type your message here..."
28-
fullWidth
29-
disabled={disabled}
30-
variant="outlined"
31-
size="small"
32-
sx={{ marginBottom: '1rem' }}
33-
slotProps={{
34-
input: {
35-
endAdornment: (
36-
<IconButton type="submit" disabled={disabled}>
37-
<Send />
38-
</IconButton>
39-
),
40-
},
23+
<Container
24+
disableGutters
25+
sx={{
26+
position: 'fixed',
27+
bottom: '8rem',
28+
// width: '100%',
29+
}}
30+
>
31+
<Paper
32+
sx={{
33+
marginBottom: '1rem',
4134
}}
42-
/>
43-
</form>
35+
elevation={3}
36+
component="form"
37+
onSubmit={handleSubmit}
38+
onKeyDown={(e) => {
39+
if (e.key === 'Enter' && !e.shiftKey) {
40+
e.preventDefault()
41+
handleSubmit(e)
42+
}
43+
}}
44+
>
45+
<TextField
46+
value={message}
47+
onChange={(e) => setMessage(e.target.value)}
48+
placeholder="Type your message here..."
49+
fullWidth
50+
multiline
51+
disabled={disabled}
52+
variant="standard"
53+
sx={{ padding: '0.5rem' }}
54+
slotProps={{
55+
input: {
56+
sx: {
57+
padding: '0.5rem',
58+
fontSize: '1.5rem',
59+
// lineHeight: '1.5rem',
60+
},
61+
endAdornment: (
62+
<IconButton disabled={disabled} type="submit">
63+
<Send />
64+
</IconButton>
65+
),
66+
},
67+
}}
68+
/>
69+
</Paper>
70+
</Container>
4471
)
4572
}

0 commit comments

Comments
 (0)