({ className, children, ...props }: TabPanelProps)
| 39 | export const SnippetTabPanels = TabPanels |
| 40 | |
| 41 | export function SnippetTabPanel({ className, children, ...props }: TabPanelProps) { |
| 42 | const { copy, copied } = useClipboard() |
| 43 | return ( |
| 44 | <TabPanel className={cx('mt-0 px-4 py-2 text-sm dark:bg-secondary/70', className)} {...props}> |
| 45 | {(values) => ( |
| 46 | <> |
| 47 | {typeof children === 'function' ? ( |
| 48 | <pre className="truncate">{children(values)}</pre> |
| 49 | ) : ( |
| 50 | <div className="flex items-center justify-between"> |
| 51 | <pre className="truncate">{children}</pre> |
| 52 | <Button |
| 53 | className="-me-2" |
| 54 | size="sq-sm" |
| 55 | intent="plain" |
| 56 | onPress={() => { |
| 57 | copy(children as string) |
| 58 | }} |
| 59 | > |
| 60 | {copied ? ( |
| 61 | <> |
| 62 | <svg |
| 63 | data-slot="icon" |
| 64 | xmlns="http://www.w3.org/2000/svg" |
| 65 | fill="none" |
| 66 | viewBox="0 0 24 24" |
| 67 | strokeWidth={1.5} |
| 68 | stroke="currentColor" |
| 69 | > |
| 70 | <path |
| 71 | strokeLinecap="round" |
| 72 | strokeLinejoin="round" |
| 73 | d="m4.5 12.75 6 6 9-13.5" |
| 74 | /> |
| 75 | </svg> |
| 76 | <span className="sr-only">Copied</span> |
| 77 | </> |
| 78 | ) : ( |
| 79 | <> |
| 80 | <svg |
| 81 | data-slot="icon" |
| 82 | viewBox="0 0 18 18" |
| 83 | fill="none" |
| 84 | xmlns="http://www.w3.org/2000/svg" |
| 85 | > |
| 86 | <path |
| 87 | d="M14.25 5.25H7.25C6.14543 5.25 5.25 6.14543 5.25 7.25V14.25C5.25 15.3546 6.14543 16.25 7.25 16.25H14.25C15.3546 16.25 16.25 15.3546 16.25 14.25V7.25C16.25 6.14543 15.3546 5.25 14.25 5.25Z" |
| 88 | stroke="currentColor" |
| 89 | strokeWidth="1.5" |
| 90 | strokeLinecap="round" |
| 91 | strokeLinejoin="round" |
| 92 | /> |
| 93 | <path |
| 94 | d="M2.80103 11.998L1.77203 5.07397C1.61003 3.98097 2.36403 2.96397 3.45603 2.80197L10.38 1.77297C11.313 1.63397 12.19 2.16297 12.528 3.00097" |
| 95 | stroke="currentColor" |
| 96 | strokeWidth="1.5" |
| 97 | strokeLinecap="round" |
| 98 | strokeLinejoin="round" |
nothing calls this directly
no test coverage detected