This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from KennethTrecy/web_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(post): separate the post viewer
- Loading branch information
1 parent
4b4e2d3
commit 480e3d0
Showing
2 changed files
with
67 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<div class="post-container" :hidden="post.isPostShown"> | ||
<div class="left"> | ||
<div><img src="./images/emptyUser.png"/></div> | ||
<h2 class="title"> | ||
{{ post.user }} | ||
</h2> | ||
</div> | ||
<div class="middle"> | ||
<h2 class="title"> | ||
{{ post.title }} | ||
{{ post.badWordExist() }} | ||
</h2> | ||
</div> | ||
<div class="right"> | ||
<h2 class="title"> | ||
{{ voteCountUpdate(post) }} | ||
</h2> | ||
<label class="switch"> | ||
<input | ||
type="checkbox" | ||
:checked="determineUserVoted(post)" | ||
class="switch" | ||
@click="upVote($event, post)"/> | ||
<span class="slider"></span> | ||
</label> | ||
<h2 class="title"> | ||
{{ downVoteCountUpdate(post) }} | ||
</h2> | ||
<label class="switch"> | ||
<input | ||
type="checkbox" | ||
:checked="determineUserDownVoted(post)" | ||
class="switch" | ||
@click="downVote($event, post)"/> | ||
<span class="slider"></span> | ||
</label> | ||
|
||
<h2 class="title"> | ||
{{ totalVotes(post) }} | ||
</h2> | ||
</div> | ||
<p :class="`${post.id}`"> | ||
{{ post.desc }} | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
</style> | ||
|
||
<script setup lang="ts"> | ||
import { | ||
voteCountUpdate, | ||
determineUserVoted, | ||
upVote, | ||
downVoteCountUpdate, | ||
determineUserDownVoted, | ||
downVote, | ||
totalVotes | ||
} from "./post" | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters