({
children,
title,
...props
}: React.ComponentPropsWithoutRef<typeof CodeGroupPanels> & { title: string })
| 329 | const CodeGroupContext = createContext(false); |
| 330 | |
| 331 | export function CodeGroup({ |
| 332 | children, |
| 333 | title, |
| 334 | ...props |
| 335 | }: React.ComponentPropsWithoutRef<typeof CodeGroupPanels> & { title: string }) { |
| 336 | let languages = |
| 337 | Children.map(children, child => |
| 338 | getPanelTitle(isValidElement(child) ? (child.props as { title?: string; language?: string }) : {}) |
| 339 | ) ?? []; |
| 340 | let tabGroupProps = useTabGroupProps(languages); |
| 341 | // let hasTabs = Children.count(children) > 1; |
| 342 | |
| 343 | let containerClassName = |
| 344 | 'my-6 overflow-hidden rounded-2xl bg-background shadow-md dark:ring-6 dark:ring-[#3B3765]'; |
| 345 | let header = ( |
| 346 | <CodeGroupHeader |
| 347 | title={title} |
| 348 | selectedIndex={tabGroupProps.selectedIndex} |
| 349 | > |
| 350 | {children} |
| 351 | </CodeGroupHeader> |
| 352 | ); |
| 353 | let panels = <CodeGroupPanels {...props}>{children}</CodeGroupPanels>; |
| 354 | |
| 355 | return ( |
| 356 | <CodeGroupContext.Provider value={true}> |
| 357 | {/* {hasTabs ? ( */} |
| 358 | <TabGroup {...tabGroupProps} className={containerClassName}> |
| 359 | <div className="not-prose"> |
| 360 | {header} |
| 361 | {panels} |
| 362 | </div> |
| 363 | </TabGroup> |
| 364 | {/* ) : ( |
| 365 | <div className={containerClassName}> |
| 366 | <div className="not-prose"> |
| 367 | {header} |
| 368 | {panels} |
| 369 | </div> |
| 370 | </div> |
| 371 | )} */} |
| 372 | </CodeGroupContext.Provider> |
| 373 | ); |
| 374 | } |
| 375 | |
| 376 | export function Code({ |
| 377 | children, |
nothing calls this directly
no test coverage detected