[resumes][feat] resumes sorting and filtering (#374)

* [resumes][fix] use spinner for laggy star

* [resumes][feat] add filtering for resumes

* [resumes][feat] add sorting of resumes
This commit is contained in:
Peirong
2022-10-13 17:55:15 +08:00
committed by GitHub
parent fd67a20a2b
commit a6700a2bca
5 changed files with 177 additions and 137 deletions

View File

@@ -1,4 +1,4 @@
import { formatDistanceToNow } from 'date-fns';
import formatDistanceToNow from 'date-fns/formatDistanceToNow';
import Link from 'next/link';
import type { UrlObject } from 'url';
import { ChevronRightIcon } from '@heroicons/react/20/solid';

View File

@@ -4,10 +4,16 @@ export const BROWSE_TABS_VALUES = {
STARRED: 'starred',
};
export const SORT_OPTIONS = [
{ current: true, href: '#', name: 'Latest' },
{ current: false, href: '#', name: 'Popular' },
{ current: false, href: '#', name: 'Top Comments' },
export type SortOrder = 'latest' | 'popular' | 'topComments';
type SortOption = {
name: string;
value: SortOrder;
};
export const SORT_OPTIONS: Array<SortOption> = [
{ name: 'Latest', value: 'latest' },
{ name: 'Popular', value: 'popular' },
{ name: 'Top Comments', value: 'topComments' },
];
export const TOP_HITS = [
@@ -17,45 +23,46 @@ export const TOP_HITS = [
{ href: '#', name: 'US Only' },
];
export const ROLES = [
export type FilterOption = {
label: string;
value: string;
};
export const ROLE: Array<FilterOption> = [
{
checked: false,
label: 'Full-Stack Engineer',
value: 'Full-Stack Engineer',
},
{ checked: false, label: 'Frontend Engineer', value: 'Frontend Engineer' },
{ checked: false, label: 'Backend Engineer', value: 'Backend Engineer' },
{ checked: false, label: 'DevOps Engineer', value: 'DevOps Engineer' },
{ checked: false, label: 'iOS Engineer', value: 'iOS Engineer' },
{ checked: false, label: 'Android Engineer', value: 'Android Engineer' },
{ label: 'Frontend Engineer', value: 'Frontend Engineer' },
{ label: 'Backend Engineer', value: 'Backend Engineer' },
{ label: 'DevOps Engineer', value: 'DevOps Engineer' },
{ label: 'iOS Engineer', value: 'iOS Engineer' },
{ label: 'Android Engineer', value: 'Android Engineer' },
];
export const EXPERIENCE = [
{ checked: false, label: 'Freshman', value: 'Freshman' },
{ checked: false, label: 'Sophomore', value: 'Sophomore' },
{ checked: false, label: 'Junior', value: 'Junior' },
{ checked: false, label: 'Senior', value: 'Senior' },
export const EXPERIENCE: Array<FilterOption> = [
{ label: 'Freshman', value: 'Freshman' },
{ label: 'Sophomore', value: 'Sophomore' },
{ label: 'Junior', value: 'Junior' },
{ label: 'Senior', value: 'Senior' },
{
checked: false,
label: 'Fresh Grad (0-1 years)',
value: 'Fresh Grad (0-1 years)',
},
{
checked: false,
label: 'Mid-level (2 - 5 years)',
value: 'Mid-level (2 - 5 years)',
},
{
checked: false,
label: 'Senior (5+ years)',
value: 'Senior (5+ years)',
},
];
export const LOCATION = [
{ checked: false, label: 'Singapore', value: 'Singapore' },
{ checked: false, label: 'United States', value: 'United States' },
{ checked: false, label: 'India', value: 'India' },
export const LOCATION: Array<FilterOption> = [
{ label: 'Singapore', value: 'Singapore' },
{ label: 'United States', value: 'United States' },
{ label: 'India', value: 'India' },
];
export const TEST_RESUMES = [