@@ -142,6 +142,8 @@ type Props = {
142142 setMobileFiltersOpen : any
143143 setFavoriteToggled : any
144144 favoriteToggled : any
145+ ownedToggled : boolean
146+ setOwnedToggled : any
145147}
146148
147149const sortOptions = [
@@ -168,6 +170,8 @@ const BeastMarketFilters: FC<Props> = ({
168170 setMobileFiltersOpen,
169171 favoriteToggled,
170172 setFavoriteToggled,
173+ ownedToggled,
174+ setOwnedToggled,
171175} ) => {
172176 // const [mobileFiltersOpen, setMobileFiltersOpen] = useState(false)
173177
@@ -294,7 +298,7 @@ const BeastMarketFilters: FC<Props> = ({
294298 </ button >
295299 </ div >
296300
297- { /* Filters */ }
301+ { /* Filters for mobile */ }
298302 < form className = "mt-4 border-t" >
299303 < h3 className = "sr-only" > Categories</ h3 >
300304 < ul role = "list" className = "px-2 py-2 font-medium " >
@@ -463,7 +467,7 @@ const BeastMarketFilters: FC<Props> = ({
463467 </ h2 >
464468
465469 < div className = "grid grid-cols-1 gap-x-8 gap-y-10 " >
466- { /* Filters */ }
470+ { /* Filters for desktop */ }
467471 < form className = "hidden lg:block" >
468472 < h3 className = "sr-only" > Categories</ h3 >
469473 < ul role = "list" className = "pb-6 text-sm font-medium " >
@@ -487,76 +491,96 @@ const BeastMarketFilters: FC<Props> = ({
487491 < SwitchSlider > </ SwitchSlider >
488492 </ Switch >
489493 ) }
494+ { category . name == "Owned" && (
495+ < Switch >
496+ < SwitchInput
497+ defaultChecked = { ownedToggled }
498+ type = "checkbox"
499+ onChange = { ( ) => {
500+ setOwnedToggled ( ! ownedToggled )
501+ } }
502+ />
503+ < SwitchSlider > </ SwitchSlider >
504+ </ Switch >
505+ ) }
490506 </ li >
491507 ) ) }
492508 </ ul >
493-
494- { filters ?. map ( ( section : any ) => (
495- < Disclosure
496- as = "div"
497- key = { section . id }
498- style = { { backgroundColor : "#111823" } }
499- className = " border-t border-gray-500 py-6"
500- >
501- { ( { open } ) => (
502- < >
503- < h3 className = "-my-3 flow-root" >
504- < Disclosure . Button className = "flex w-full items-center justify-between py-3 text-sm text-white hover:text-gray-500" >
505- < span
506- style = { { fontSize : "1.3em" } }
507- className = "font-medium "
508- >
509- { section . name }
510- </ span >
511- < span className = "ml-6 flex items-center" >
512- { open ? (
513- < MinusIcon
514- className = "h-4 w-4"
515- aria-hidden = "true"
516- />
517- ) : (
518- < PlusIcon
519- className = "h-4 w-4"
520- aria-hidden = "true"
521- />
522- ) }
523- </ span >
524- </ Disclosure . Button >
525- </ h3 >
526- < Disclosure . Panel className = "pt-6" >
527- < div className = "space-y-4" >
528- { section . options ?. map (
529- ( option : any , optionIdx : any ) => (
530- < CheckboxWrapper
531- key = { option . value }
532- className = "flex items-center"
509+ { ownedToggled || favoriteToggled ? (
510+ < > </ >
511+ ) : (
512+ < >
513+ { filters ?. map ( ( section : any ) => (
514+ < Disclosure
515+ as = "div"
516+ key = { section . id }
517+ style = { { backgroundColor : "#111823" } }
518+ className = " border-t border-gray-500 py-6"
519+ >
520+ { ( { open } ) => (
521+ < >
522+ < h3 className = "-my-3 flow-root" >
523+ < Disclosure . Button className = "flex w-full items-center justify-between py-3 text-sm text-white hover:text-gray-500" >
524+ < span
525+ style = { { fontSize : "1.3em" } }
526+ className = "font-medium "
533527 >
534- < input
535- id = { `filter-${ section . id } -${ optionIdx } ` }
536- name = { `${ section . id } []` }
537- defaultValue = { option . value }
538- type = "checkbox"
539- defaultChecked = { option . checked }
540- onChange = { ( ) =>
541- handleChange ( section . id , option . value )
542- }
543- className = "h-4 w-4 rounded border-gray-300 focus:ring-indigo-500"
544- />
545- < label
546- htmlFor = { `filter-${ section . id } -${ optionIdx } ` }
547- className = "ml-3 text-sm "
548- >
549- { option . label }
550- </ label >
551- </ CheckboxWrapper >
552- ) ,
553- ) }
554- </ div >
555- </ Disclosure . Panel >
556- </ >
557- ) }
558- </ Disclosure >
559- ) ) }
528+ { section . name }
529+ </ span >
530+ < span className = "ml-6 flex items-center" >
531+ { open ? (
532+ < MinusIcon
533+ className = "h-4 w-4"
534+ aria-hidden = "true"
535+ />
536+ ) : (
537+ < PlusIcon
538+ className = "h-4 w-4"
539+ aria-hidden = "true"
540+ />
541+ ) }
542+ </ span >
543+ </ Disclosure . Button >
544+ </ h3 >
545+ < Disclosure . Panel className = "pt-6" >
546+ < div className = "space-y-4" >
547+ { section . options ?. map (
548+ ( option : any , optionIdx : any ) => (
549+ < CheckboxWrapper
550+ key = { option . value }
551+ className = "flex items-center"
552+ >
553+ < input
554+ id = { `filter-${ section . id } -${ optionIdx } ` }
555+ name = { `${ section . id } []` }
556+ defaultValue = { option . value }
557+ type = "checkbox"
558+ defaultChecked = { option . checked }
559+ onChange = { ( ) =>
560+ handleChange (
561+ section . id ,
562+ option . value ,
563+ )
564+ }
565+ className = "h-4 w-4 rounded border-gray-300 focus:ring-indigo-500"
566+ />
567+ < label
568+ htmlFor = { `filter-${ section . id } -${ optionIdx } ` }
569+ className = "ml-3 text-sm "
570+ >
571+ { option . label }
572+ </ label >
573+ </ CheckboxWrapper >
574+ ) ,
575+ ) }
576+ </ div >
577+ </ Disclosure . Panel >
578+ </ >
579+ ) }
580+ </ Disclosure >
581+ ) ) }
582+ </ >
583+ ) }
560584 </ form >
561585 </ div >
562586 </ section >
0 commit comments