mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 07:50:20 +08:00
wip <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit # Release Notes * **New Features** * Added a new Learn application offering foundational Supabase courses with interactive documentation * Courses include Architecture, Authentication, Data Fundamentals, Security, Storage, Realtime, and Edge Functions * Chapter tracking and progress indicators for course completions * Responsive sidebar navigation with search/command menu * Theme switching support (light, dark, classic dark modes) * Mobile-friendly course interface <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alan Daniel <stylesshjs@gmail.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
41 lines
984 B
TypeScript
41 lines
984 B
TypeScript
'use client'
|
|
|
|
import { Check, Copy } from 'lucide-react'
|
|
import * as React from 'react'
|
|
|
|
import { Button, cn, copyToClipboard } from 'ui'
|
|
|
|
interface CopyButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
value: string
|
|
src?: string
|
|
}
|
|
|
|
export function CopyButton({ value, className, src, ...props }: CopyButtonProps) {
|
|
const [hasCopied, setHasCopied] = React.useState(false)
|
|
|
|
React.useEffect(() => {
|
|
setTimeout(() => {
|
|
setHasCopied(false)
|
|
}, 2000)
|
|
}, [hasCopied])
|
|
|
|
return (
|
|
<Button
|
|
size="small"
|
|
type="outline"
|
|
className={cn(
|
|
'relative z-10 h-6 w-6 text-foreground-muted hover:bg-surface-100 hover:text-foreground p-0',
|
|
className
|
|
)}
|
|
onClick={() => {
|
|
copyToClipboard(value)
|
|
setHasCopied(true)
|
|
}}
|
|
{...props}
|
|
>
|
|
<span className="sr-only">Copy</span>
|
|
{hasCopied ? <Check className="h-3 w-3 text-brand-600" /> : <Copy className="h-3 w-3" />}
|
|
</Button>
|
|
)
|
|
}
|