Boilerplate logic for votes added in frontend, Header added for post creation

This commit is contained in:
Hollgy 2024-03-18 18:34:11 +01:00
parent 6093751799
commit b7d00d4e75
2 changed files with 9 additions and 3 deletions

View file

@ -40,6 +40,7 @@ export function NewPostInputArea(): JSXElement {
when={!waiting()} when={!waiting()}
fallback={<span class="loading loading-spinner loading-lg self-center" />} fallback={<span class="loading loading-spinner loading-lg self-center" />}
> >
<span>Create a new post</span>
<div class="flex w-full flex-col space-y-2"> <div class="flex w-full flex-col space-y-2">
<textarea <textarea
class="textarea textarea-bordered h-32" class="textarea textarea-bordered h-32"

View file

@ -6,7 +6,7 @@ import { Post } from "../Util/api";
/** /**
* PostSegment is used to display posts in both the main feed and the post view * PostSegment is used to display posts in both the main feed and the post view
* *
* @param {Object} props The properties for the PostSegment component. * @param {Object} props The properties for the PostSegment component.
* @param {Post} props.post The post to display. * @param {Post} props.post The post to display.
* @returns {JSXElement} A JSXElement of a post * @returns {JSXElement} A JSXElement of a post
@ -26,13 +26,18 @@ export function PostSegment({ post }: { post: Post }): JSXElement {
</Show> </Show>
<p class="break-words text-base-content md:pt-2">{post.content}</p> <p class="break-words text-base-content md:pt-2">{post.content}</p>
<div class="card-actions justify-between"> <div class="card-actions justify-between">
<div class="flex w-24 space-x-3 space-y-1.5">
<button <button
// onClick={(engagement)} // onClick={(engagement)}
class="btn btn-xs hover:border-x-primary" class="btn btn-xs hover:border-primary"
aria-label="Show sign of engagement" aria-label="Show sign of engagement"
> >
<EngagementIcon /> <EngagementIcon />
</button> </button>
<span class="countdown text-1xl">
<span style={{ "--value": 46 }}>{post.votes}</span>
</span>
</div>
<button <button
onClick={(): void => nav("/post/" + post.id)} onClick={(): void => nav("/post/" + post.id)}
class="btn btn-xs" class="btn btn-xs"