Using Lightbox to filter repeater

I have a repeater that I want to filter through. Putting everything on that first page would be too bulky so I want to create a Lightbox. From what I’ve gathered I should be using a button to close the lightbox and pass that information onto the main page so it can do the search.

I have the lightbox opening from the filter button. There are three separate categories to choose from. The lightbox closes when search is pressed.

thank you to anybody that can help.

This is the code from the lightbox

import wixWindow from ‘wix-window’ ;

export function searchButton_click_1 ( event ) {
wixWindow . lightbox . close ({
“mealType” : String ( $w ( “#mealType” ). value ),
“meatPref” : String ( $w ( “#meatPref” ). value ),
“flavors” : String ( $w ( ‘#flavors’ ). value )

 }); 

}

This the code from the main page.

import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;

export function text8_click ( event ) {
wixWindow . openLightbox ( “Filter” ,{
“mealType” : String ( $w ( “#mealType” ). value ),
“meatPref” : String ( $w ( “#meatPref” ). value ),
“flavors” : String ( $w ( ‘#flavors’ ). value )
})

        wixData . query ( "Recipes1" ) 
        . contains ( "mealType" ,  String ( $w ( '#mealType' ). value )) 
    . and ( wixData . query ( "Recipes1" ). contains ( "meatPref" ,  String ( $w ( '#meatPref' ). value ))) 
    . and ( wixData . query ( "Recipes1" ). hasSome ( '#flavors' , String (  $w ( '#flavors' ). value ))) 

    . find () 
    . then ( results  => { 
    
           $w ( '#repeater1' ). data  =  results . items 
           }) 

}

It should be something like:

//page:
//in the event handler:
wixWindow.openLightbox('LightboxName', dataObject/*if you want to pass info from the page to the lightbox*/)
.then(data /*data object received on lightbox close*/ => {
//use the data to filter the dataset
})

No need to put the input values inside String().