File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff 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 >
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ export type TabDefinition = {
1111export 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
5759const 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"
You can’t perform that action at this time.
0 commit comments