@@ -56,7 +56,8 @@ interface SearchMenuProps {
5656 currentPage : Page ,
5757 onClose : ( ) => void ,
5858 overlayId ?: string ,
59- initialSearchValue : string
59+ initialSearchValue : string ,
60+ isSearchOpen : boolean
6061}
6162
6263function CloseButton ( { onClose} : { onClose : ( ) => void } ) {
@@ -72,7 +73,7 @@ function CloseButton({onClose}: {onClose: () => void}) {
7273}
7374
7475export function SearchMenu ( props : SearchMenuProps ) {
75- let { pages, currentPage, onClose, overlayId} = props ;
76+ let { pages, currentPage, onClose, overlayId, isSearchOpen } = props ;
7677
7778 const currentLibrary = getLibraryFromPage ( currentPage ) ;
7879 let [ selectedLibrary , setSelectedLibrary ] = useState < Library > ( currentLibrary ) ;
@@ -258,11 +259,11 @@ export function SearchMenu(props: SearchMenuProps) {
258259 { orderedTabs . map ( ( tab , i ) => (
259260 < Tab key = { tab . id } id = { tab . id } >
260261 < div className = { style ( { display : 'flex' , gap : 12 , marginTop : 4 } ) } >
261- < div style = { { viewTransitionName : i === 0 ? 'search-menu-icon' : 'none' } as CSSProperties } >
262+ < div style = { { viewTransitionName : ( i === 0 && isSearchOpen ) ? 'search-menu-icon' : 'none' } as CSSProperties } >
262263 { tab . icon }
263264 </ div >
264265 < div >
265- < span style = { { viewTransitionName : i === 0 ? 'search-menu-label' : 'none' } as CSSProperties } className = { style ( { font : 'ui-2xl' } ) } >
266+ < span style = { { viewTransitionName : ( i === 0 && isSearchOpen ) ? 'search-menu-label' : 'none' } as CSSProperties } className = { style ( { font : 'ui-2xl' } ) } >
266267 { tab . label }
267268 </ span >
268269 < div className = { style ( { fontSize : 'ui-sm' } ) } > { tab . description } </ div >
@@ -289,7 +290,7 @@ export function SearchMenu(props: SearchMenuProps) {
289290 size = "L"
290291 aria-label = { `Search ${ tab . label } ` }
291292 placeholder = { placeholderText }
292- UNSAFE_style = { { marginInlineEnd : 296 , viewTransitionName : i === 0 ? 'search-menu-search-field' : 'none' } as CSSProperties }
293+ UNSAFE_style = { { marginInlineEnd : 296 , viewTransitionName : ( i === 0 && isSearchOpen ) ? 'search-menu-search-field' : 'none' } as CSSProperties }
293294 styles = { style ( { width : 500 } ) } />
294295 </ div >
295296
0 commit comments