-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Paribesh01/job-board
- Loading branch information
Showing
3 changed files
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useMemo } from 'react'; | ||
import { JobQuerySchemaType } from '@/lib/validators/jobs.validator'; | ||
|
||
export const useFilterCheck = (formValues: JobQuerySchemaType) => { | ||
const isAnyFilterSelected = useMemo(() => { | ||
return ['workmode', 'EmpType', 'salaryrange', 'city'].some((key) => { | ||
const value = formValues[key as keyof JobQuerySchemaType]; | ||
if (Array.isArray(value)) { | ||
return value.length > 0; | ||
} | ||
// For non-array values, check if they're truthy | ||
return !!value; | ||
}); | ||
}, [formValues]); | ||
|
||
return isAnyFilterSelected; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters