Skip to content

Commit

Permalink
refactor: adding comment component
Browse files Browse the repository at this point in the history
  • Loading branch information
rzashakeri committed Jul 2, 2022
1 parent d14ef4a commit 21551dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 8 additions & 0 deletions post/templates/post/components/comment_component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<a href="{% url 'show_post' slug=post.slug %}" type="submit" class="flex gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
</svg>
<span id="comment-count">{{ post.comment_set.count }}</span>
</a>
10 changes: 2 additions & 8 deletions post/templates/post/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,10 @@ <h1 class="text-xl font-bold capitalize">{{ post.user.get_full_name }}</h1>
<p>{{ post.caption }}</p>
<span class="text-sm text-gray-400">{{ post.created_at|time_format }}</span>
<div class="flex gap-3 justify-between z-autos">

{% include "post/components/like_component.html" %}

<a href="{% url 'show_post' slug=post.slug %}" type="submit" class="flex gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"></path>
</svg>
<span id="comment-count">{{ post.comment_set.count }}</span>
</a>
{% include "post/components/comment_component.html" %}

<div class="flex gap-2 tooltip tooltip-bottom" data-tip="Viral">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
Expand Down

0 comments on commit 21551dd

Please sign in to comment.