Skip to content

Commit

Permalink
fix: inline code block copy button position
Browse files Browse the repository at this point in the history
Signed-off-by: ZTL-UwU <[email protected]>
  • Loading branch information
ZTL-UwU committed Aug 3, 2024
1 parent 197b60b commit bb89fd4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 57 deletions.
33 changes: 16 additions & 17 deletions components/content/ProseCode.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<template>
<UiCard
class="[&:not(:first-child)]:mt-5 [&:not(:last-child)]:mb-5 overflow-hidden"
class="[&:not(:first-child)]:mt-5 [&:not(:last-child)]:mb-5 relative overflow-hidden"
:class="[inGroup && 'rounded-t-none border-none mb-0']"
>
<div v-if="!inGroup && filename" class="p-3 border-b flex text-sm font-mono">
<Icon v-if="icon" :name="icon" class="self-center mr-1.5" />
{{ filename }}
<CodeCopy :code="code" class="ml-auto mr-1" />
</div>
<UiScrollArea>
<div
class="py-3 bg-muted/30 text-sm relative overflow-x-auto"
:class="[`highlight-${language}`, !filename && 'inline-copy', !language && 'pl-3']"
>
<span v-if="!filename" class="absolute right-4">
<CodeCopy :code="code" />
</span>
<slot />
</div>
<ScrollBar orientation="horizontal" />
</UiScrollArea>

<span v-if="!filename" class="absolute top-3 right-3">
<CodeCopy :code="code" />
</span>
<div class="pr-9 bg-muted/30">
<UiScrollArea>
<div
class="py-3 text-sm overflow-x-auto"
:class="[`highlight-${language}`, !filename && 'inline-copy', !language && 'pl-3']"
>
<slot />
</div>
<ScrollBar orientation="horizontal" />
</UiScrollArea>
</div>
</UiCard>
</template>

Expand Down Expand Up @@ -72,8 +75,4 @@ const icon = iconMap.get(props.filename?.toLowerCase()) || iconMap.get(props.lan
padding-left: 0.75rem;
padding-right: 0.75rem;
}
.inline-copy .line {
padding-right: 2.7rem;
}
</style>
38 changes: 0 additions & 38 deletions content/1.getting-started/4.changelog.md

This file was deleted.

2 changes: 1 addition & 1 deletion content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ navigation: false
::hero
---
announcement:
title: 'Release v0.4.3'
title: 'Release v0.4.5'
icon: 'noto:party-popper'
to: /getting-started/changelog
actions:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shadcn-docs-nuxt",
"type": "module",
"version": "0.4.4",
"version": "0.4.5",
"author": "Tony Zhang <[email protected]>",
"license": "MIT",
"homepage": "https://shadcn-docs.nuxt.dev/",
Expand Down

0 comments on commit bb89fd4

Please sign in to comment.