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

Commit dc525fa

Browse files
committed
adjust styling of code block titles and make copy consistent
1 parent bbd8410 commit dc525fa

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

src/components/code/CodeSwitcherSelect.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export function CodeSwitcherSelect({
6161
>
6262
<SelectTrigger
6363
aria-label="Switch code language"
64-
className="absolute right-[68px] top-[6.5px] hidden h-8 w-28 bg-white/5 text-2xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-300/10 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5 md:flex"
64+
className="absolute right-2 top-[3px] z-10 hidden h-8 w-28 bg-white/5 text-2xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-300/10 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5 md:flex"
6565
>
6666
<SelectValue />
6767
</SelectTrigger>
@@ -78,7 +78,7 @@ export function CodeSwitcherSelect({
7878
onChange={(e) => setCurrentLanguage(e.target.value as LanguageId)}
7979
className={cn(
8080
'flex h-8 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
81-
'absolute right-[72px] top-[6.5px] w-24 bg-white/5 font-sans text-2xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-300/10 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5 md:hidden',
81+
'absolute right-2 top-[3px] z-10 w-24 bg-white/5 font-sans text-2xs font-medium text-zinc-400 ring-1 ring-inset ring-zinc-300/10 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5 md:hidden',
8282
)}
8383
value={selectedLang}
8484
>

src/components/code/CopyButton.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ export function CopyButton({
3131
type="button"
3232
className={cn(
3333
'group/button absolute right-2 h-8 rounded-md px-1.5 py-1 text-2xs font-medium backdrop-blur transition',
34-
showPanel ? 'top-[6.5px]' : 'top-2.5',
34+
showPanel ? 'top-12' : 'top-2.5',
3535
copied
3636
? 'bg-primary-400/10 ring-primary-400/20'
3737
: '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',
38-
!showPanel &&
39-
'opacity-0 focus:opacity-100 group-hover:opacity-100 group-focus:opacity-100',
38+
'opacity-0 focus:opacity-100 group-hover:opacity-100 group-focus:opacity-100',
4039
className,
4140
)}
4241
onClick={() => {

src/components/code/Pre.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ const Pre: React.FC<Props> = ({
4444
return (
4545
<>
4646
{showFileNamePanel && (
47-
<div className="flex h-12 items-center justify-start border-b border-zinc-300/10 bg-zinc-800/50 pr-12 font-display text-2xs font-semibold text-zinc-300 sm:text-xs">
47+
<div className="relative flex h-10 items-center justify-start pr-12 font-display text-2xs text-zinc-300 sm:text-xs">
4848
{/* one-off breakpoint to hide the filename on extremely narrow screens - to avoid interfering with the lang select */}
49-
<span className="hidden whitespace-nowrap px-4 py-2 min-[320px]:block">
50-
{title}
51-
</span>
49+
<div className="relative flex h-full items-center border-r border-zinc-300/5">
50+
<span className="hidden whitespace-nowrap px-4 py-2 min-[320px]:block">
51+
{title}
52+
</span>
53+
<div className="absolute bottom-0 h-[1px] w-full bg-primary-300" />
54+
</div>
55+
<div className="absolute bottom-0 h-[1px] w-full bg-zinc-300/5" />
5256
</div>
5357
)}
54-
<CopyButton
55-
code={highlighted.code}
56-
showPanel={showPanel}
57-
className={copyButtonClassName}
58-
/>
58+
<CopyButton code={highlighted.code} showPanel={showPanel} />
5959
<CodeHikePre
6060
code={highlighted}
6161
handlers={handlers}

src/components/tabs/Tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ export const Tabs: React.FC<TabProps> = ({ children, value, ref, syncKey }) => {
3131
onValueChange={syncKey ? (value) => set(syncKey, value) : undefined}
3232
ref={ref}
3333
>
34-
<TabsList className="relative mx-0 mt-auto h-12 w-full rounded-b-none bg-transparent p-0">
34+
<TabsList className="relative mx-0 mb-2 mt-auto h-12 w-full rounded-b-none bg-transparent p-0">
3535
{tabs.map((tab) => (
3636
<TabsTrigger
3737
value={tab.props.label}
3838
key={tab.props.label}
3939
className="group/tab relative h-12 data-[state=active]:bg-transparent data-[state=active]:text-primary dark:hover:text-zinc-200 dark:data-[state=active]:text-primary-300"
4040
>
4141
{tab.props.label}
42-
<div className="absolute inset-x-2 bottom-0 h-px bg-primary opacity-0 transition-opacity group-data-[state=active]/tab:opacity-100 dark:bg-primary-300" />
42+
<div className="absolute inset-x-0 bottom-0 h-px bg-primary opacity-0 transition-opacity group-data-[state=active]/tab:opacity-100 dark:bg-primary-300" />
4343
</TabsTrigger>
4444
))}
4545
<div className="absolute inset-x-0 bottom-0 h-px bg-zinc-300/10" />

0 commit comments

Comments
 (0)