fixed design and functionality of NewPostForm
This commit is contained in:
26
src/App.scss
26
src/App.scss
@@ -34,21 +34,25 @@ h1 {
|
|||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 1em;
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
|
||||||
|
&.single-row {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.textarea-container {
|
.textarea-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 15px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-size: 1em;
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.char-count-container {
|
.char-count-container {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
|
|||||||
@@ -6,23 +6,26 @@ const NewPostForm = ({ addPost }) => {
|
|||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (text.trim()) {
|
if (text.trim() && title.trim()) {
|
||||||
addPost(text);
|
addPost(title, text);
|
||||||
setText('');
|
setText('');
|
||||||
|
setTitle('');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="new-post-form" onSubmit={handleSubmit}>
|
<form className="new-post-form" onSubmit={handleSubmit}>
|
||||||
<input
|
<textarea
|
||||||
type="text"
|
className="single-row"
|
||||||
|
rows={1}
|
||||||
value={title}
|
value={title}
|
||||||
onChange={(e) => setTitle(e.target.value)}
|
onChange={(e) => setTitle(e.target.value)}
|
||||||
placeholder="Titel"
|
placeholder="Titel"
|
||||||
|
maxLength={50}
|
||||||
/>
|
/>
|
||||||
<div className="textarea-container">
|
<div className="textarea-container">
|
||||||
<textarea
|
<textarea
|
||||||
rows={5}
|
rows={15}
|
||||||
value={text}
|
value={text}
|
||||||
onChange={(e) => setText(e.target.value)}
|
onChange={(e) => setText(e.target.value)}
|
||||||
placeholder="Schreibe einen neuen Jodel..."
|
placeholder="Schreibe einen neuen Jodel..."
|
||||||
|
|||||||
Reference in New Issue
Block a user