Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 9ce6340

Browse files
committed
style updates for tabs
1 parent 17f408e commit 9ce6340

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/components/code/CodeWithTabs.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ export function CodeTabs(props: {
4545
value={tab.meta}
4646
className="m-0 border-t border-zinc-300/10"
4747
>
48-
<Pre
49-
highlighted={highlighted[i]}
50-
showPanel={!!highlighted[i].meta}
51-
/>
48+
<Pre highlighted={highlighted[i]} copyButtonClassName="top-12" />
5249
</TabsContent>
5350
))}
5451
</Tabs>

src/components/code/CopyButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import { ClipboardIcon } from '../icons/ClipboardIcon'
77
export function CopyButton({
88
code,
99
showPanel,
10+
className,
1011
}: {
1112
code: string
1213
showPanel?: boolean
14+
className?: string
1315
}) {
1416
const [copyCount, setCopyCount] = useState(0)
1517
const copied = copyCount > 0
@@ -34,6 +36,7 @@ export function CopyButton({
3436
: 'bg-white/5 ring-1 ring-inset ring-zinc-300/10 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5',
3537
!showPanel &&
3638
'opacity-0 focus:opacity-100 group-hover:opacity-100 group-focus:opacity-100',
39+
className,
3740
)}
3841
onClick={() => {
3942
window.navigator.clipboard.writeText(code).then(() => {

src/components/code/Pre.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ type Props = {
2020
highlighted: HighlightedCode
2121
showPanel?: boolean
2222
className?: string
23+
copyButtonClassName?: string
2324
} & HandlerProps
2425

2526
const Pre: React.FC<Props> = ({
2627
highlighted,
2728
showPanel,
2829
enableTransitions,
2930
className,
31+
copyButtonClassName,
3032
}) => {
3133
const fileName = highlighted.meta
3234

@@ -46,7 +48,11 @@ const Pre: React.FC<Props> = ({
4648
</span>
4749
</div>
4850
)}
49-
<CopyButton code={highlighted.code} showPanel={showPanel} />
51+
<CopyButton
52+
code={highlighted.code}
53+
showPanel={showPanel}
54+
className={copyButtonClassName}
55+
/>
5056
<CodeHikePre
5157
code={highlighted}
5258
handlers={handlers}

src/components/nav/NavigationGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function NavigationGroup({
2020

2121
return (
2222
<li className={cn('relative mt-6', className)}>
23-
<h2 className="pl-2 text-xs font-semibold text-zinc-900 dark:text-white">
23+
<h2 className="pl-2 text-2xs font-semibold text-zinc-900 dark:text-white">
2424
{group.title}
2525
</h2>
2626
<div className="relative mt-3">

0 commit comments

Comments
 (0)