Skip to content

Commit

Permalink
fix: code copy button is invisible when hover (#323)
Browse files Browse the repository at this point in the history
* fix: code copy button is invisible when hover

* chore: update hugo_stats.json file
  • Loading branch information
imfing committed Mar 18, 2024
1 parent c634cb8 commit 29e70c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions exampleSite/hugo_stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,6 @@
"group-hover/code:hx-opacity-100",
"group-hover:hx-underline",
"group-open:before:hx-rotate-90",
"group/code",
"group/copybtn",
"hamburger-menu",
"hextra-card",
"hextra-cards",
Expand Down Expand Up @@ -303,6 +301,8 @@
"hx-grid",
"hx-grid-cols-1",
"hx-group",
"hx-group/code",
"hx-group/copybtn",
"hx-grow",
"hx-h-0",
"hx-h-16",
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/_markup/render-codeblock.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{- $copyCode := (T "copyCode") | default "Copy code" -}}


<div class="code-block hx-relative hx-mt-6 first:hx-mt-0 group/code">
<div class="code-block hx-relative hx-mt-6 first:hx-mt-0 hx-group/code">
{{- if $filename -}}
<div class="filename" dir="auto">{{ $filename }}</div>
{{- end -}}
Expand All @@ -15,7 +15,7 @@
{{- end -}}
<div class="hx-opacity-0 hx-transition group-hover/code:hx-opacity-100 hx-flex hx-gap-1 hx-absolute hx-m-[11px] hx-right-0 {{ if $filename }}hx-top-8{{ else }}hx-top-0{{ end }}">
<button
class="code-copy-btn group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50"
class="code-copy-btn hx-group/copybtn hx-transition-all active:hx-opacity-50 hx-bg-primary-700/5 hx-border hx-border-black/5 hx-text-gray-600 hover:hx-text-gray-900 hx-rounded-md hx-p-1.5 dark:hx-bg-primary-300/10 dark:hx-border-white/10 dark:hx-text-gray-400 dark:hover:hx-text-gray-50"
title="{{ $copyCode }}"
>
<div class="copy-icon group-[.copied]/copybtn:hx-hidden hx-pointer-events-none hx-h-4 hx-w-4"></div>
Expand Down

0 comments on commit 29e70c8

Please sign in to comment.