Skip to content

Commit 622f0c5

Browse files
authored
Merge pull request #51 from kaseyvee/text-input
feat(textInput): move position of send button
2 parents 01bcad7 + 691199a commit 622f0c5

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.rustic-text-input-container {
2+
display: flex;
3+
gap: 8px;
4+
}
5+
16
.rustic-text-input {
27
border-radius: 16px;
38
}

src/components/textInput/textInput.tsx

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import './textInput.css'
22

33
import SendIcon from '@mui/icons-material/Send'
4+
import Box from '@mui/material/Box'
45
import IconButton from '@mui/material/IconButton'
5-
import InputAdornment from '@mui/material/InputAdornment'
66
import TextField from '@mui/material/TextField'
77
import { useState } from 'react'
88
import React from 'react'
@@ -61,36 +61,32 @@ export default function TextInput(props: TextInputProps) {
6161
}
6262

6363
return (
64-
<TextField
65-
data-cy="text-input"
66-
className="rustic-text-input"
67-
variant="outlined"
68-
value={messageText}
69-
label={props.label}
70-
maxRows={props.maxRows}
71-
multiline={props.multiline}
72-
fullWidth={props.fullWidth}
73-
onKeyDown={handleKeyDown}
74-
onChange={handleOnChange}
75-
sx={{
76-
backgroundColor: 'background.paper',
77-
}}
78-
InputProps={{
79-
endAdornment: (
80-
<InputAdornment position="end">
81-
<IconButton
82-
data-cy="send-button"
83-
aria-label="send message"
84-
onClick={handleSendMessage}
85-
disabled={isEmptyMessage}
86-
color="primary"
87-
>
88-
<SendIcon />
89-
</IconButton>
90-
</InputAdornment>
91-
),
92-
}}
93-
/>
64+
<Box className="rustic-text-input-container">
65+
<TextField
66+
data-cy="text-input"
67+
className="rustic-text-input"
68+
variant="outlined"
69+
value={messageText}
70+
label={props.label}
71+
maxRows={props.maxRows}
72+
multiline={props.multiline}
73+
fullWidth={props.fullWidth}
74+
onKeyDown={handleKeyDown}
75+
onChange={handleOnChange}
76+
sx={{
77+
backgroundColor: 'background.paper',
78+
}}
79+
/>
80+
<IconButton
81+
data-cy="send-button"
82+
aria-label="send message"
83+
onClick={handleSendMessage}
84+
disabled={isEmptyMessage}
85+
color="primary"
86+
>
87+
<SendIcon />
88+
</IconButton>
89+
</Box>
9490
)
9591
}
9692

0 commit comments

Comments
 (0)