Skip to content

Commit b0596ef

Browse files
Merge branch 'main' into eslint-updates
2 parents 8df98c3 + 7cbde06 commit b0596ef

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/components/Markdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ const options: HTMLReactParserOptions = {
329329
domToReact(panel.children as any, options)
330330
)
331331

332-
return <Tabs tabs={tabs} children={children as any} />
332+
return (
333+
<Tabs id={attributes.id} tabs={tabs} children={children as any} />
334+
)
333335
}
334336
default:
335337
return <div>{domToReact(domNode.children as any, options)}</div>

src/components/Tabs.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ export type TabDefinition = {
1111
export type TabsProps = {
1212
tabs: Array<TabDefinition>
1313
children: Array<React.ReactNode>
14+
id: string
1415
}
1516

16-
export function Tabs({ tabs, children }: TabsProps) {
17+
export function Tabs({ tabs, id, children }: TabsProps) {
1718
const Route = getRouteApi()
1819
const { framework } = Route.useParams()
1920

@@ -27,6 +28,7 @@ export function Tabs({ tabs, children }: TabsProps) {
2728
{tabs.map((tab) => {
2829
return (
2930
<Tab
31+
id={id}
3032
tab={tab}
3133
activeSlug={activeSlug}
3234
setActiveSlug={setActiveSlug}
@@ -40,7 +42,7 @@ export function Tabs({ tabs, children }: TabsProps) {
4042
if (!tab) return null
4143
return (
4244
<div
43-
key={tab.slug}
45+
key={`${id}-${tab.slug}`}
4446
data-tab={tab.slug}
4547
hidden={tab.slug !== activeSlug}
4648
className="prose dark:prose-invert max-w-none flex flex-col gap-2 text-base"
@@ -55,18 +57,20 @@ export function Tabs({ tabs, children }: TabsProps) {
5557
}
5658

5759
const Tab = ({
60+
id,
5861
tab,
5962
activeSlug,
6063
setActiveSlug,
6164
}: {
65+
id: string
6266
tab: TabDefinition
6367
activeSlug: string
6468
setActiveSlug: React.Dispatch<React.SetStateAction<string>>
6569
}) => {
6670
const options = React.useMemo(() => getFrameworkOptions(tab.slug), [tab.slug])
6771
return (
6872
<button
69-
key={tab.slug}
73+
key={`${id}-${tab.slug}`}
7074
aria-label={tab.name}
7175
title={tab.name}
7276
type="button"

0 commit comments

Comments
 (0)