replying functionality works kind of

This commit is contained in:
Joonas 2023-01-12 22:48:16 +02:00
parent 734a2405d3
commit 02535ec636
1 changed files with 5 additions and 2 deletions

View File

@ -83,10 +83,12 @@ export default function Thread() {
<li className="p-4" key={post.id}>
<a name={`${post.id}`}></a>
<span>Reply id: <strong>{post.id}</strong> Replied at: <strong>{post.createdAt} </strong></span>
<button className="text-sky-600" onClick={() => {
<a href="#bottom"><button className="text-sky-600" onClick={() => {
setReplying(post.id)
}}>Reply</button>
}}>Reply</button></a>
<br />
{post.replyingTo ? <a className="font-semibold text-sm hover:underline" href={`#${post.replyingTo}`}> Replying to id: {post.replyingTo}</a> : ''}
{post.imageName !== null ? <a href={`/uploads/${post.imageName}`} target="_blank" referrerPolicy="no-referrer"><img width={240} src={`/uploads/${post.imageName}`} alt="post image" /></a> : ''}
<p>{post.comment}</p>
</li>
@ -94,6 +96,7 @@ export default function Thread() {
</ul>
</div>
<Form className="bg-slate-100 p-4 space-y-2 shadow flex flex-col justify-center items-center" method="post" encType="multipart/form-data">
<a className="" name="bottom"></a>
<label htmlFor="text-input">
{replying ? <p>Replying to reply id: {replying}</p> : ''}
Post: <input required minLength={3} name="post" type="text" />