/
githubmirror
/
tldraw
Обзор
Документация
Войти
/
githubmirror
/
tldraw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
apps/docs/components/common/share-button.tsx
39 строк
911 B
Mime Čuvalo
chore: sort imports using oxfmt (#8330)
24 мар 2026, 15:22
Не верифицирован
24 мар 2026, 15:22
374dfed
Код
Авторство
О чём код?
'use client' import { CheckIcon, ShareIcon } from '@heroicons/react/20/solid' import { useState } from 'react' import { cn } from '@/utils/cn' export function ShareButton({ url, size = 'small', className, }: { url: string size?: 'small' | 'base' className?: string }) { const [copied, setCopied] = useState<boolean>(false) return ( <button onClick={() => { navigator.clipboard.writeText(url) setCopied(true) setTimeout(() => setCopied(false), 1500) }} className={cn( 'flex items-center gap-1.5 text-blue-500 hover:text-blue-600 dark:hover:text-blue-400 mb-4', size === 'small' && 'text-xs', className )} > {copied ? ( <CheckIcon className={size === 'small' ? 'h-3.5' : 'h-4'} /> ) : ( <ShareIcon className={size === 'small' ? 'h-3.5' : 'h-4'} /> )} <span>{copied ? 'Link copied to clipboard' : 'Share this article'}</span> </button> ) }