File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ search:
5555 thumbs_up : This answer was helpful
5656 thumbs_down : This answer was not helpful
5757 thumbs_announcement : Thank you for your feedback!
58+ back_to_search : Back to search
5859 failure :
5960 general_title : There was an error loading search results.
6061 ai_title : There was an error loading Copilot.
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ search:
5555 thumbs_up : This answer was helpful
5656 thumbs_down : This answer was not helpful
5757 thumbs_announcement : Thank you for your feedback!
58+ back_to_search : Back to search
5859 failure :
5960 general_title : There was an error loading search results.
6061 ai_title : There was an error loading Copilot.
Original file line number Diff line number Diff line change 55 ActionList ,
66 Box ,
77 Header ,
8+ IconButton ,
89 Link ,
910 Overlay ,
1011 Spinner ,
@@ -20,6 +21,7 @@ import {
2021 CopilotIcon ,
2122 FileIcon ,
2223 ArrowRightIcon ,
24+ ArrowLeftIcon ,
2325} from '@primer/octicons-react'
2426
2527import { useTranslation } from 'src/languages/components/useTranslation'
@@ -483,6 +485,15 @@ export function SearchOverlay({
483485 }
484486 }
485487
488+ const onBackButton = ( ) => {
489+ // Leave the Ask AI state when the user clicks the back button
490+ setSelectedIndex ( - 1 )
491+ updateParams ( {
492+ 'search-overlay-ask-ai' : '' ,
493+ 'search-overlay-input' : urlSearchInputQuery ,
494+ } )
495+ }
496+
486497 // We render the AI Result in the searchGroups call, so we pass the props down via an object
487498 // TODO: Move stateful logic to Context since we now have so many props:
488499 const askAIState = {
@@ -626,6 +637,20 @@ export function SearchOverlay({
626637 ref = { overlayRef }
627638 >
628639 < Header className = { styles . header } >
640+ < Box
641+ sx = { {
642+ display : isAskAIState ? 'flex' : 'none' ,
643+ marginRight : '8px' ,
644+ fontWeight : 'bolder' ,
645+ } }
646+ >
647+ < IconButton
648+ aria-label = { t ( 'search.ai.back_to_search' ) }
649+ icon = { ArrowLeftIcon }
650+ onClick = { onBackButton }
651+ variant = "invisible"
652+ > </ IconButton >
653+ </ Box >
629654 < TextInput
630655 className = "width-full"
631656 data-testid = "overlay-search-input"
You can’t perform that action at this time.
0 commit comments