@@ -133,6 +133,16 @@ export type SearchSongActionRenderArgs = {
133133 resultState : SearchSongResultState ;
134134} ;
135135
136+ type SearchPanelControlsRenderArgs = {
137+ query : string ;
138+ debouncedQuery : string ;
139+ data ?: SearchResponse ;
140+ visibleResults : SearchSong [ ] ;
141+ isLoading : boolean ;
142+ queryTooShort : boolean ;
143+ hasSearchInput : boolean ;
144+ } ;
145+
136146export function SongSearchPanel ( props : {
137147 title : string ;
138148 eyebrow ?: string ;
@@ -151,7 +161,9 @@ export function SongSearchPanel(props: {
151161 } ) => ReactNode ) ;
152162 useTotalForSummary ?: boolean ;
153163 summaryContent ?: ReactNode ;
154- controlsContent ?: ReactNode ;
164+ controlsContent ?:
165+ | ReactNode
166+ | ( ( args : SearchPanelControlsRenderArgs ) => ReactNode ) ;
155167 actionsLabel ?: string ;
156168 renderActions ?: ( args : SearchSongActionRenderArgs ) => ReactNode ;
157169} ) {
@@ -393,6 +405,18 @@ export function SongSearchPanel(props: {
393405 visibleResults,
394406 } )
395407 : props . advancedFiltersContent ;
408+ const resolvedControlsContent =
409+ typeof props . controlsContent === "function"
410+ ? props . controlsContent ( {
411+ query,
412+ debouncedQuery,
413+ data,
414+ visibleResults,
415+ isLoading,
416+ queryTooShort,
417+ hasSearchInput,
418+ } )
419+ : props . controlsContent ;
396420
397421 async function copyRequest (
398422 song : SearchSong ,
@@ -709,8 +733,8 @@ export function SongSearchPanel(props: {
709733 </ Button >
710734 </ div >
711735
712- { props . controlsContent ? (
713- < div className = "grid gap-3" > { props . controlsContent } </ div >
736+ { resolvedControlsContent ? (
737+ < div className = "grid gap-3" > { resolvedControlsContent } </ div >
714738 ) : null }
715739
716740 { showAdvanced ? (
0 commit comments