Change tabs to keep all individual tab components in the DOM (#743)
This commit is contained in:
parent
99326eb65a
commit
daa86fa330
|
@ -28,7 +28,6 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) {
|
||||||
className,
|
className,
|
||||||
currentPageForAnalytics,
|
currentPageForAnalytics,
|
||||||
} = props
|
} = props
|
||||||
const activeTab = tabs[activeIndex] as Tab | undefined // can be undefined in weird case
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<nav
|
<nav
|
||||||
|
@ -64,7 +63,11 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) {
|
||||||
</a>
|
</a>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
{activeTab?.content}
|
{tabs.map((tab, i) => (
|
||||||
|
<div key={i} className={i === activeIndex ? 'block' : 'hidden'}>
|
||||||
|
{tab.content}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user