refactor: improve code maintainability
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
mediaGridClass=${mediaSize == 1 ? 'grid-cols-1' : (mediaSize < 5 ? 'grid-cols-2' : 'grid-cols-3')}
|
||||
"
|
||||
class="moment on-list post"
|
||||
th:attr="x-data=|{ name: '${name}', showComment: false }|">
|
||||
th:attr="data-moment-name=${name}">
|
||||
|
||||
<header>
|
||||
<div class="post-meta">
|
||||
@@ -58,8 +58,7 @@
|
||||
|
||||
<footer class="moment-footer">
|
||||
<button class="moment-action-btn moment-upvote-btn"
|
||||
th:attr="data-name=${name},data-count=${upvoteCount}"
|
||||
onclick="handleUpvote(this.dataset.name)">
|
||||
th:attr="data-moment-action='upvote',data-moment-name=${name},data-count=${upvoteCount}">
|
||||
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="currentColor" width="16" height="16">
|
||||
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
|
||||
@@ -75,8 +74,7 @@
|
||||
</button>
|
||||
|
||||
<button class="moment-action-btn moment-comment-btn"
|
||||
th:attr="data-target=${commentId}"
|
||||
onclick="showComment(this.dataset.target)">
|
||||
th:attr="data-moment-action='toggle-comment',data-comment-target=${commentId}">
|
||||
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="currentColor" width="16" height="16">
|
||||
<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/>
|
||||
|
||||
Reference in New Issue
Block a user