Skip to content

Commit 4693d29

Browse files
committed
multyline add
1 parent 484509a commit 4693d29

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Cards/AddCard.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from 'react'
2-
// eslint-disable-next-line no-unused-vars
32
import PropTypes from 'prop-types'
3+
import TextareaAutosize from 'react-textarea-autosize'
4+
45
function useInputValue(defaultValue) {
56
const [value, setValue] = useState(defaultValue)
67

@@ -26,19 +27,18 @@ function AddCard({ onCreate, onDeleteAll }) {
2627
}
2728
}
2829

29-
function onEnter(e) {
30-
if (e.keyCode === 13) {
31-
submitHandler();
32-
}
33-
}
34-
3530
return (
3631

3732
<div className="container">
3833
<div className="row my-2 text-center">
3934

4035
<div className="col-lg-12 col-md-12 p-1">
41-
<input onKeyDown={onEnter} type="text" className="form-control" placeholder="Card text" id="Text" {...input.bind} />
36+
<TextareaAutosize type="text" className="form-control" placeholder="Card text" id="Text"
37+
{...input.bind}
38+
style={{ resize: "none" }}
39+
minRows={1}
40+
maxRows={7}
41+
/>
4242
</div>
4343

4444
<div className="col-lg-8 col-md-6 col-sm-4 p-1">

0 commit comments

Comments
 (0)