diff options
| author | Eltrac <hi@guhub.cn> | 2025-09-27 14:18:34 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-09-27 14:18:34 +0800 |
| commit | a6b8fe66a76f71757c71669db6337a007b2eab5d (patch) | |
| tree | 46c640b8f54c50a2b25fd9d9730babf57b41a56e | |
| parent | 17ebcdac3c4f8d89dabd8b0cb6698f8c5aa0caa8 (diff) | |
refactor: separate action menu into modules
| -rw-r--r-- | layouts/_partials/posts/action-menu.html | 61 | ||||
| -rw-r--r-- | layouts/_partials/posts/action-menu/comment-button.html | 7 | ||||
| -rw-r--r-- | layouts/_partials/posts/action-menu/info-links.html | 18 | ||||
| -rw-r--r-- | layouts/_partials/posts/action-menu/like-button.html | 26 |
4 files changed, 56 insertions, 56 deletions
diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index d05a61d1..740d7902 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -1,67 +1,16 @@ <div id="action-menu" class="my-8 mb-4"> - <!-- 操作按钮组 --> + <!-- Action Buttons --> <div class="flex justify-between items-center mb-6"> <div class="flex gap-2"> - <button class="dark:invert flex items-center justify-center gap-1.5 min-w-12 h-12 px-2 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:bg-black/5 hover:rounded-lg group" - id="comments-toggle" title="{{ T "actionMenu.comment" }}" data-tooltip> - <img src="/img/comments.svg" width="20" height="20" - alt="{{ T "actionMenu.comment" }}" - class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> - <span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="comment-count">...</span> - </button> - - <!-- 点赞按钮 --> - <div class="relative" id="like-container-{{ .File.UniqueID | urlize }}"> - <button class="dark:invert flex items-center justify-center gap-1.5 min-w-12 h-12 px-2 - border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 - hover:bg-black/5 hover:rounded-lg group animate-count-infinite" - onclick="sendLike('{{ .File.UniqueID | urlize }}')" - id="like-btn-{{ .File.UniqueID | urlize }}" - title="{{ T "actionMenu.like" }}" - data-liked-title="{{ T "actionMenu.liked" }}" - data-tooltip> - <img src="/img/heart-organ.svg" width="20" height="20" - alt="{{ T "actionMenu.like" }}" - class="brightness-40 flex-shrink-0 transition-all duration-300 dark:brightness-70 dark:contrast-120" id="like-icon-{{ .File.UniqueID | urlize }}" /> - <span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="like-count-{{ .File.UniqueID | urlize }}">...</span> - </button> - </div> - </div> - - {{ if eq .Site.Language.Lang "zh" }} - <div class="flex gap-1"> - <a href="https://t.me/geedeapro" target="_blank" data-tooltip - class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" - title="{{ T "actionMenu.telegramChannel" }}" data-umami-event="✈️ Click Telegram link from post tabs"> - <img src="/img/radio.svg" width="16" height="16" - alt="{{ T "actionMenu.telegramChannel" }}" - class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> - </a> - <a href="/sponsor" data-tooltip - class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" - title="{{ T "actionMenu.sponsor" }}" data-umami-event="💗 Click sponsor button from post tabs"> - <img src="/img/coffee.svg" width="16" height="16" - alt="{{ T "actionMenu.sponsor" }}" - class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> - </a> + {{ partial "posts/action-menu/comment-button" . }} + {{ partial "posts/action-menu/like-button" . }} + {{ partial "posts/action-menu/info-links" . }} </div> - {{ end }} </div> - - <!-- 评论区域 --> + <!-- Comment Section --> <div class="overflow-hidden my-4"> <div class="mt-4 hidden animate-duration-200" id="comments-section"> {{ partial "posts/comment.html" . }} </div> </div> </div> - -<style> -.liked-heart { - filter: brightness(0) saturate(100%) invert(8%) sepia(100%) saturate(7500%) hue-rotate(0deg) brightness(70%) contrast(150%) !important; -} - -.liked-count { - color: #8B0000 !important; -} -</style> diff --git a/layouts/_partials/posts/action-menu/comment-button.html b/layouts/_partials/posts/action-menu/comment-button.html new file mode 100644 index 00000000..bc079a4f --- /dev/null +++ b/layouts/_partials/posts/action-menu/comment-button.html @@ -0,0 +1,7 @@ +<button class="dark:invert flex items-center justify-center gap-1.5 min-w-12 h-12 px-2 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:bg-black/5 hover:rounded-lg group" + id="comments-toggle" title="{{ T "actionMenu.comment" }}" data-tooltip> + <img src="/img/comments.svg" width="20" height="20" + alt="{{ T "actionMenu.comment" }}" + class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> + <span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="comment-count">...</span> +</button> diff --git a/layouts/_partials/posts/action-menu/info-links.html b/layouts/_partials/posts/action-menu/info-links.html new file mode 100644 index 00000000..f1547d81 --- /dev/null +++ b/layouts/_partials/posts/action-menu/info-links.html @@ -0,0 +1,18 @@ +{{ if eq .Site.Language.Lang "zh" }} +<div class="flex gap-1"> + <a href="https://t.me/geedeapro" target="_blank" data-tooltip + class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" + title="{{ T "actionMenu.telegramChannel" }}" data-umami-event="✈️ Click Telegram link from post tabs"> + <img src="/img/radio.svg" width="16" height="16" + alt="{{ T "actionMenu.telegramChannel" }}" + class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> + </a> + <a href="/sponsor" data-tooltip + class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" + title="{{ T "actionMenu.sponsor" }}" data-umami-event="💗 Click sponsor button from post tabs"> + <img src="/img/coffee.svg" width="16" height="16" + alt="{{ T "actionMenu.sponsor" }}" + class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" /> + </a> +</div> +{{ end }} diff --git a/layouts/_partials/posts/action-menu/like-button.html b/layouts/_partials/posts/action-menu/like-button.html new file mode 100644 index 00000000..c4c50c91 --- /dev/null +++ b/layouts/_partials/posts/action-menu/like-button.html @@ -0,0 +1,26 @@ +<!-- 点赞按钮 --> +<div class="relative" id="like-container-{{ .File.UniqueID | urlize }}"> + <button class="dark:invert flex items-center justify-center gap-1.5 min-w-12 h-12 px-2 + border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 + hover:bg-black/5 hover:rounded-lg group animate-count-infinite" + onclick="sendLike('{{ .File.UniqueID | urlize }}')" + id="like-btn-{{ .File.UniqueID | urlize }}" + title="{{ T "actionMenu.like" }}" + data-liked-title="{{ T "actionMenu.liked" }}" + data-tooltip> + <img src="/img/heart-organ.svg" width="20" height="20" + alt="{{ T "actionMenu.like" }}" + class="brightness-40 flex-shrink-0 transition-all duration-300 dark:brightness-70 dark:contrast-120" id="like-icon-{{ .File.UniqueID | urlize }}" /> + <span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="like-count-{{ .File.UniqueID | urlize }}">...</span> + </button> +</div> + +<style> +.liked-heart { + filter: brightness(0) saturate(100%) invert(8%) sepia(100%) saturate(7500%) hue-rotate(0deg) brightness(70%) contrast(150%) !important; +} + +.liked-count { + color: #8B0000 !important; +} +</style> |
