Skip to content

Commit

Permalink
Added value to Textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Di Nella committed Oct 10, 2023
1 parent dfcff61 commit 9f14cfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/components/molecules/MessageInput/MessageInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const MessageInput = ({
onSendMessage = () => null,
onChange = () => null,
placeholder,
value,
}) => {
const [disableButton, setDisableButton] = useState(true)

Expand Down Expand Up @@ -52,6 +53,7 @@ const MessageInput = ({
placeholder={placeholder}
onChange={handleChange}
onKeyDown={handleKeyDown}
value={value}
/>
<span className="message-btn">
<SendButton disabled={disableButton} />
Expand All @@ -64,6 +66,7 @@ const MessageInput = ({
MessageInput.propTypes = {
id: PropTypes.string,
onSendMessage: PropTypes.func,
onSubmit: PropTypes.func,
onChange: PropTypes.func,
placeholder: PropTypes.string,
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/molecules/Textarea/Textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const StyledTextarea = styled.textarea.withConfig({ shouldForwardProp })`
${styles}
`

const Textarea = ({ id, placeholder, onBlur, onChange, onKeyDown }) => {
const Textarea = ({ id, placeholder, value, onBlur, onChange, onKeyDown }) => {
const handleInput = (e) => {
const textarea = e.target
textarea.style.height = 'auto'
Expand All @@ -35,6 +35,7 @@ const Textarea = ({ id, placeholder, onBlur, onChange, onKeyDown }) => {
onBlur={onBlur}
onChange={handleInput}
onKeyDown={onKeyDown}
value={value}
/>
)
}
Expand Down

0 comments on commit 9f14cfc

Please sign in to comment.