Skip to content

Commit

Permalink
fix: update copy button
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Mar 3, 2024
1 parent 0761eaa commit a94194e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/components/ui/code-highlighter/CodeHighlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ const useLoadHighlighter = (ref: React.RefObject<HTMLElement>) => {
})
} else {
requestAnimationFrame(() => {
window.Prism?.highlightAll()
// highlightAll twice

requestAnimationFrame(() => {
window.Prism?.highlightAll()
})
Expand Down
13 changes: 5 additions & 8 deletions src/components/ui/code-highlighter/shiki/Shiki.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ export const ShikiHighLighter: FC<Props> = (props) => {
{!filename && !!language && (
<div
aria-hidden
className={clsxm(
'pointer-events-none absolute bottom-2 right-2 z-10 text-sm opacity-60',
isOverflow ? 'right-6' : '',
)}
className="pointer-events-none absolute bottom-2 right-2 z-10 text-sm opacity-60"
>
{language.toUpperCase()}
</div>
Expand All @@ -144,9 +141,9 @@ export const ShikiHighLighter: FC<Props> = (props) => {
<MotionButtonBase
onClick={handleCopy}
className={clsx(
'text-xscenter absolute right-2 top-[calc(1rem-3px)] z-[1] flex rounded border border-current p-2',
'dark:bg-primary-300/10 rounded-md border border-black/5 bg-accent/5 p-1.5 text-gray-600 duration-200 hover:text-gray-900 dark:border-white/10 dark:text-gray-400 dark:hover:text-gray-50',
'opacity-0 group-hover:opacity-60',
'absolute right-2 top-[calc(1rem-3px)] z-[1] flex rounded border border-current p-2 text-xs center',
'rounded-md border border-black/5 bg-accent/80 p-1.5 text-white backdrop-blur duration-200 dark:border-white/10',
'opacity-0 group-hover:opacity-100',
)}
>
<i className="icon-[mingcute--copy-2-fill] h-4 w-4" />
Expand Down Expand Up @@ -178,7 +175,7 @@ export const ShikiHighLighter: FC<Props> = (props) => {
className={`absolute bottom-0 left-0 right-0 flex justify-center py-2 duration-200 ${
['mask-both-lg', 'mask-b-lg'].includes(maskClassName)
? ''
: 'opacity-0'
: 'pointer-events-none opacity-0'
}`}
>
<button
Expand Down

0 comments on commit a94194e

Please sign in to comment.