Change tabs to keep all individual tab components in the DOM

This commit is contained in:
Marshall Polaris 2022-08-10 17:52:10 -07:00
parent 8c537537a1
commit 12f1305b95

View File

@ -28,7 +28,6 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) {
className,
currentPageForAnalytics,
} = props
const activeTab = tabs[activeIndex] as Tab | undefined // can be undefined in weird case
return (
<>
<nav
@ -64,7 +63,11 @@ export function ControlledTabs(props: TabProps & { activeIndex: number }) {
</a>
))}
</nav>
{activeTab?.content}
{tabs.map((tab, i) => (
<div key={i} className={i === activeIndex ? 'block' : 'hidden'}>
{tab.content}
</div>
))}
</>
)
}