Skip to content

Commit

Permalink
docs: add more props on CopyButton
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-ub committed Nov 9, 2024
1 parent fa99894 commit c36bb9a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/src/components/CopyButton.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
import { cn } from '@/lib/utils'
import { buttonVariants } from '@/registry/new-york/ui/button'
import { buttonVariants, type ButtonVariant } from '@/registry/new-york/ui/button'
export interface Props {
class: string
value: string
variant?: ButtonVariant
}
const { value, class: className } = Astro.props
const { value, class: className, variant = 'ghost' } = Astro.props
function escapeValue(value: string) {
return value.replace(/`/g, '\\`').replace(/\n/g, '\\n').replace(/\$\{/g, '\\${')
Expand All @@ -17,7 +18,7 @@ function escapeValue(value: string) {
<button
class={cn(
buttonVariants({
variant: 'ghost',
variant,
size: 'icon',
class: cn(
'relative z-10 h-6 w-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50 [&_svg]:h-3 [&_svg]:w-3',
Expand Down

0 comments on commit c36bb9a

Please sign in to comment.