@@ -16,6 +16,8 @@ import {
1616 DrawerPanelBody ,
1717 DropdownList ,
1818 DropdownItem ,
19+ TabContent ,
20+ TabContentBody ,
1921} from '@patternfly/react-core' ;
2022import {
2123 LoadingBox ,
@@ -102,6 +104,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
102104 if ( activeQuickStartID !== quickStartId ) {
103105 // activate
104106 setActiveQuickStartID ( quickStartId ) ;
107+ setActiveTabKey ( 1 ) ;
105108 // optionally add the query param
106109 withQueryParams && setQueryArgument ( QUICKSTART_ID_FILTER_KEY , quickStartId ) ;
107110 } else {
@@ -133,7 +136,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
133136 const onModalCancel = ( ) => setModalOpen ( false ) ;
134137
135138 const [ isDrawerOpen , setIsDrawerOpen ] = React . useState ( false ) ;
136- const [ activeTabKey , setActiveTabKey ] = React . useState < string | number > ( 0 ) ;
139+ const [ activeTabKey , setActiveTabKey ] = React . useState < string | number > ( 1 ) ;
137140 // Toggle currently active tab
138141 const handleTabClick = (
139142 event : React . MouseEvent < any > | React . KeyboardEvent | MouseEvent ,
@@ -305,6 +308,9 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
305308 ) ;
306309 // Chatbot
307310
311+ const contentRef1 = React . createRef < HTMLElement > ( ) ;
312+ const contentRef2 = React . createRef < HTMLElement > ( ) ;
313+
308314 const panelContent = (
309315 < DrawerPanelContent isResizable >
310316 < DrawerHead >
@@ -325,19 +331,45 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
325331 >
326332 { activeQuickStartID !== '' && (
327333 < Tab
328- eventKey = { 0 }
334+ eventKey = { 1 }
329335 title = { < TabTitleText > Quickstart</ TabTitleText > }
330336 aria-label = "Default content - users"
331- style = { { flex : '1 1' , display : 'flex' , flexDirection : 'column' } } // not currently spread to tab - react issue opened https://github.com/patternfly/patternfly-react/issues/11342
332- >
333- < QuickStartController quickStart = { quickStart } nextQuickStarts = { nextQuickStart } />
334- </ Tab >
337+ tabContentId = "tab1SectionBodyPadding"
338+ tabContentRef = { contentRef1 }
339+ />
335340 ) }
336341
337- < Tab eventKey = { 1 } title = { < TabTitleText > Chatbot</ TabTitleText > } >
338- { chatbot }
339- </ Tab >
342+ < Tab
343+ eventKey = { 2 }
344+ title = { < TabTitleText > Chatbot</ TabTitleText > }
345+ tabContentId = "tab2SectionBodyPadding"
346+ tabContentRef = { contentRef2 }
347+ />
340348 </ Tabs >
349+ < >
350+ { activeTabKey === 1 && (
351+ < TabContent
352+ eventKey = { 1 }
353+ id = "tab1SectionBodyPadding"
354+ ref = { contentRef1 }
355+ style = { { flex : '1 1' , display : 'flex' , flexDirection : 'column' } }
356+ >
357+ < TabContentBody >
358+ < QuickStartController quickStart = { quickStart } nextQuickStarts = { nextQuickStart } />
359+ </ TabContentBody >
360+ </ TabContent >
361+ ) }
362+ { activeTabKey === 2 && (
363+ < TabContent
364+ eventKey = { 2 }
365+ id = "tab2SectionBodyPadding"
366+ ref = { contentRef2 }
367+ style = { { flex : '1 1' , display : 'flex' , flexDirection : 'column' } }
368+ >
369+ < TabContentBody > { chatbot } </ TabContentBody >
370+ </ TabContent >
371+ ) }
372+ </ >
341373 </ DrawerPanelBody >
342374 </ DrawerPanelContent >
343375 ) ;
@@ -363,7 +395,7 @@ const App: React.FC<AppProps> = ({ children, showCardFooters }) => {
363395 toggleQuickStart ( 'getting-started-with-quick-starts' ) ;
364396 } }
365397 >
366- Toggle QS
398+ Toggle QS & set tab to QS
367399 </ Button >
368400 { children }
369401 </ Page >
0 commit comments