[question][chore] add constants.ts

pull/346/head
Jeff Sieu 3 years ago committed by wlren
parent bfe1657a4d
commit 2feec85981

@ -3,6 +3,12 @@ import { Button, Select } from '@tih/ui';
import NavBar from '~/components/questions/NavBar'; import NavBar from '~/components/questions/NavBar';
import {
COMPANIES,
LOCATIONS,
QUESTION_TYPES,
} from '~/utils/questions/constants';
export type LandingQueryData = { export type LandingQueryData = {
company: string; company: string;
location: string; location: string;
@ -53,20 +59,7 @@ export default function LandingComponent({
<Select <Select
isLabelHidden={true} isLabelHidden={true}
label="Type" label="Type"
options={[ options={QUESTION_TYPES}
{
label: 'Coding',
value: 'coding',
},
{
label: 'Behavioral',
value: 'behavioral',
},
{
label: 'System Design',
value: 'system design',
},
]}
value={landingQueryData.questionType} value={landingQueryData.questionType}
onChange={handleChangeType} onChange={handleChangeType}
/> />
@ -75,20 +68,7 @@ export default function LandingComponent({
<Select <Select
isLabelHidden={true} isLabelHidden={true}
label="Company" label="Company"
options={[ options={COMPANIES}
{
label: 'Google',
value: 'google',
},
{
label: 'Meta',
value: 'meta',
},
{
label: 'Amazon',
value: 'amazon',
},
]}
value={landingQueryData.company} value={landingQueryData.company}
onChange={handleChangeCompany} onChange={handleChangeCompany}
/> />
@ -96,20 +76,7 @@ export default function LandingComponent({
<Select <Select
isLabelHidden={true} isLabelHidden={true}
label="Location" label="Location"
options={[ options={LOCATIONS}
{
label: 'Singapore',
value: 'singapore',
},
{
label: 'California',
value: 'california',
},
{
label: 'Menlo Park',
value: 'menlo park',
},
]}
value={landingQueryData.location} value={landingQueryData.location}
onChange={handleChangeLocation} onChange={handleChangeLocation}
/> />

@ -9,6 +9,8 @@ export type FilterOptions = {
value: string; value: string;
}; };
export type FilterChoices = Array<Omit<FilterOptions, 'checked'>>;
export type FilterSectionProps = { export type FilterSectionProps = {
label: string; label: string;
onOptionChange: (optionValue: string, checked: boolean) => void; onOptionChange: (optionValue: string, checked: boolean) => void;

@ -3,62 +3,17 @@ import { useEffect, useMemo, useState } from 'react';
import QuestionOverviewCard from '~/components/questions/card/QuestionOverviewCard'; import QuestionOverviewCard from '~/components/questions/card/QuestionOverviewCard';
import ContributeQuestionCard from '~/components/questions/ContributeQuestionCard'; import ContributeQuestionCard from '~/components/questions/ContributeQuestionCard';
import type { FilterOptions } from '~/components/questions/filter/FilterSection';
import FilterSection from '~/components/questions/filter/FilterSection'; import FilterSection from '~/components/questions/filter/FilterSection';
import type { LandingQueryData } from '~/components/questions/LandingComponent'; import type { LandingQueryData } from '~/components/questions/LandingComponent';
import LandingComponent from '~/components/questions/LandingComponent'; import LandingComponent from '~/components/questions/LandingComponent';
import QuestionSearchBar from '~/components/questions/QuestionSearchBar'; import QuestionSearchBar from '~/components/questions/QuestionSearchBar';
type FilterChoices = Array<Omit<FilterOptions, 'checked'>>; import {
COMPANIES,
const COMPANIES: FilterChoices = [ LOCATIONS,
{ QUESTION_AGES,
label: 'Google', QUESTION_TYPES,
value: 'google', } from '~/utils/questions/constants';
},
{
label: 'Meta',
value: 'meta',
},
];
// Code, design, behavioral
const QUESTION_TYPES: FilterChoices = [
{
label: 'Coding',
value: 'coding',
},
{
label: 'Design',
value: 'design',
},
{
label: 'Behavioral',
value: 'behavioral',
},
];
const QUESTION_AGES: FilterChoices = [
{
label: 'Last month',
value: 'last-month',
},
{
label: 'Last 6 months',
value: 'last-6-months',
},
{
label: 'Last year',
value: 'last-year',
},
];
const LOCATIONS: FilterChoices = [
{
label: 'Singapore',
value: 'singapore',
},
];
export default function QuestionsHomePage() { export default function QuestionsHomePage() {
const router = useRouter(); const router = useRouter();

@ -0,0 +1,50 @@
import type { FilterChoices } from '~/components/questions/filter/FilterSection';
export const COMPANIES: FilterChoices = [
{
label: 'Google',
value: 'google',
},
{
label: 'Meta',
value: 'meta',
},
];
// Code, design, behavioral
export const QUESTION_TYPES: FilterChoices = [
{
label: 'Coding',
value: 'coding',
},
{
label: 'Design',
value: 'design',
},
{
label: 'Behavioral',
value: 'behavioral',
},
];
export const QUESTION_AGES: FilterChoices = [
{
label: 'Last month',
value: 'last-month',
},
{
label: 'Last 6 months',
value: 'last-6-months',
},
{
label: 'Last year',
value: 'last-year',
},
];
export const LOCATIONS: FilterChoices = [
{
label: 'Singapore',
value: 'singapore',
},
];
Loading…
Cancel
Save