Skip to content

Commit

Permalink
feat: 优化代码块样式
Browse files Browse the repository at this point in the history
  • Loading branch information
huayemao committed Jun 21, 2024
1 parent 000dfa7 commit f9fc467
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/Pre.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Pre = ({
const lidEl = arr[0] as ReactElement;
const containerEl = arr[1] as ReactElement;
return (
<pre {...props} ref={preRef} className="relative !pt-14">
<pre {...props} ref={preRef} className="relative !pt-10 !overflow-x-hidden">
<div className="absolute top-0 right-0 left-0 flex items-center justify-between w-full px-6 py-2 pr-4 bg-muted-700 text-muted-100">
<span className="text-xs lowercase">{lidEl.props.children}</span>
<div className="flex items-center space-x-1">
Expand Down
5 changes: 1 addition & 4 deletions components/copy-to-clipboard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BaseButtonIcon } from '@shuriken-ui/react'
import { CheckIcon, CopyIcon } from 'lucide-react'
import type { ComponentProps, ReactElement } from 'react'
import { useCallback, useEffect, useState } from 'react'
Expand Down Expand Up @@ -40,8 +39,6 @@ export const CopyToClipboard = ({

return (
/* @ts-ignore */
<BaseButtonIcon size='sm' onClick={handleClick} title="Copy code" tabIndex={0} {...props}>
<IconToUse className="h-4 w-4" />
</BaseButtonIcon>
<IconToUse className="h-4 w-4" onClick={handleClick} title="Copy code" tabIndex={0} {...props}></IconToUse>
)
}
4 changes: 4 additions & 0 deletions styles/post.module.css
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@

.content :global .code-container {
@apply overflow-x-auto;
}

0 comments on commit f9fc467

Please sign in to comment.