Skip to content

Commit

Permalink
fix: html best practice
Browse files Browse the repository at this point in the history
  • Loading branch information
dewanakl committed Dec 28, 2024
1 parent 1cdbebb commit f3fac51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions js/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ export const card = (() => {

const renderLike = (comment) => {
return `
<button style="font-size: 0.8rem;" onclick="like.like(this)" data-uuid="${comment.uuid}" class="btn btn-sm btn-outline-${theme.isDarkMode('light', 'dark')} ms-auto rounded-3 p-0" data-offline-disabled>
<div class="d-flex justify-content-start align-items-center">
<p class="my-0 mx-1" data-count-like="${comment.like.love}">${comment.like.love}</p>
<i class="me-1 ${likes.has(comment.uuid) ? 'fa-solid fa-heart text-danger' : 'fa-regular fa-heart'}"></i>
</div>
<button style="font-size: 0.8rem;" onclick="like.like(this)" data-uuid="${comment.uuid}" class="btn btn-sm btn-outline-${theme.isDarkMode('light', 'dark')} ms-auto rounded-3 p-0 d-flex justify-content-start align-items-center" data-offline-disabled>
<span class="my-0 mx-1" data-count-like="${comment.like.love}">${comment.like.love}</span>
<i class="me-1 ${likes.has(comment.uuid) ? 'fa-solid fa-heart text-danger' : 'fa-regular fa-heart'}"></i>
</button>`;
};

Expand Down
4 changes: 2 additions & 2 deletions js/like.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const like = (() => {
const like = async (button) => {
const id = button.getAttribute('data-uuid');

const heart = button.firstElementChild.lastElementChild;
const info = button.firstElementChild.firstElementChild;
const info = button.firstElementChild;
const heart = button.lastElementChild;

button.disabled = true;

Expand Down

0 comments on commit f3fac51

Please sign in to comment.