Changeset View
Changeset View
Standalone View
Standalone View
web/components/tabs.react.js
Show All 27 Lines | function TabsContainer<T: string>(props: TabsContainerProps<T>): React.Node { | ||||
const currentTab = React.Children.toArray(children).find( | const currentTab = React.Children.toArray(children).find( | ||||
tab => tab.props.id === activeTab, | tab => tab.props.id === activeTab, | ||||
); | ); | ||||
const currentContent = currentTab ? currentTab.props.children : null; | const currentContent = currentTab ? currentTab.props.children : null; | ||||
return ( | return ( | ||||
<div className={css.tabsContainer}> | <div className={css.tabsContainer}> | ||||
<div className={css.tabsHeaderContainer}>{headers}</div> | <div className={css.tabsHeaderContainer}> | ||||
<div className={css.tabsHeaderContainerPill}>{headers}</div> | |||||
</div> | |||||
{currentContent} | {currentContent} | ||||
</div> | </div> | ||||
); | ); | ||||
} | } | ||||
type TabsItemProps<T: string> = { | type TabsItemProps<T: string> = { | ||||
+children: React.Node, | +children: React.Node, | ||||
+id: T, | +id: T, | ||||
Show All 14 Lines |