({
title,
children,
selectedIndex
}: {
title: string;
children: React.ReactNode;
selectedIndex: number;
})
| 182 | } |
| 183 | |
| 184 | function CodeGroupHeader({ |
| 185 | title, |
| 186 | children, |
| 187 | selectedIndex |
| 188 | }: { |
| 189 | title: string; |
| 190 | children: React.ReactNode; |
| 191 | selectedIndex: number; |
| 192 | }) { |
| 193 | // let hasTabs = Children.count(children) > 1; |
| 194 | |
| 195 | // if (!title && !hasTabs) { |
| 196 | // return null; |
| 197 | // } |
| 198 | |
| 199 | if (!title) { |
| 200 | return null; |
| 201 | } |
| 202 | |
| 203 | return ( |
| 204 | <div className="flex min-h-[calc(theme(spacing.12)+1px)] flex-wrap items-start gap-x-4 bg-background px-4"> |
| 205 | {title && ( |
| 206 | <h3 className="mr-auto pt-3 text-xs font-semibold dark:text-white"> |
| 207 | {title} |
| 208 | </h3> |
| 209 | )} |
| 210 | {/* {hasTabs && ( */} |
| 211 | <TabList className="-mb-px flex gap-4 text-xs font-medium"> |
| 212 | {Children.map(children, (child, childIndex) => ( |
| 213 | <Tab |
| 214 | className={clsx( |
| 215 | 'border-b py-3 transition ui-not-focus-visible:outline-none', |
| 216 | childIndex === selectedIndex |
| 217 | ? 'border-[#2D2B55] text-[#2D2B55] dark:border-[#fad000] dark:text-[#fad000]' |
| 218 | : 'border-transparent text-zinc-400 hover:text-zinc-500' |
| 219 | )} |
| 220 | > |
| 221 | {getPanelTitle( |
| 222 | isValidElement(child) ? (child.props as { title?: string; language?: string }) : {} |
| 223 | )} |
| 224 | </Tab> |
| 225 | ))} |
| 226 | </TabList> |
| 227 | {/* )} */} |
| 228 | </div> |
| 229 | ); |
| 230 | } |
| 231 | |
| 232 | function CodeGroupPanels({ |
| 233 | children, |
nothing calls this directly
no test coverage detected