|
|
@ -1,19 +1,37 @@
|
|
|
|
import { useForm } from 'react-hook-form';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import { Button, Select } from '@tih/ui';
|
|
|
|
import { Button, Select } from '@tih/ui';
|
|
|
|
|
|
|
|
|
|
|
|
import NavBar from '~/components/questions/NavBar';
|
|
|
|
import NavBar from '~/components/questions/NavBar';
|
|
|
|
|
|
|
|
|
|
|
|
export type LandingQueryData = {
|
|
|
|
export type LandingQueryData = {
|
|
|
|
date: string;
|
|
|
|
company: string;
|
|
|
|
location: string;
|
|
|
|
location: string;
|
|
|
|
questionType: string;
|
|
|
|
questionType: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
export default function LandingPage() {
|
|
|
|
|
|
|
|
const { register, handleSubmit } = useForm<LandingQueryData>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const onSubmit = (data: LandingQueryData) => {
|
|
|
|
export type LandingComponentProps = {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
handleLandingQuery: (data: LandingQueryData) => void;
|
|
|
|
console.log(data);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function LandingComponent({
|
|
|
|
|
|
|
|
handleLandingQuery,
|
|
|
|
|
|
|
|
}: LandingComponentProps) {
|
|
|
|
|
|
|
|
const [landingQueryData, setLandingQueryData] = useState<LandingQueryData>({
|
|
|
|
|
|
|
|
company: 'google',
|
|
|
|
|
|
|
|
location: 'singapore',
|
|
|
|
|
|
|
|
questionType: 'coding',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleChangeCompany = (company: string) => {
|
|
|
|
|
|
|
|
setLandingQueryData((prev) => ({ ...prev, company }));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleChangeLocation = (location: string) => {
|
|
|
|
|
|
|
|
setLandingQueryData((prev) => ({ ...prev, location }));
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleChangeType = (questionType: string) => {
|
|
|
|
|
|
|
|
setLandingQueryData((prev) => ({ ...prev, questionType }));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -29,13 +47,10 @@ export default function LandingPage() {
|
|
|
|
Get to know the latest SWE interview questions asked by top companies
|
|
|
|
Get to know the latest SWE interview questions asked by top companies
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
<form
|
|
|
|
<div className="mx-auto mt-6 flex max-w-lg items-baseline gap-3 px-4 text-center text-xl text-black sm:max-w-3xl">
|
|
|
|
className="mx-auto mt-6 flex max-w-lg items-baseline gap-3 px-4 text-center text-xl text-black sm:max-w-3xl"
|
|
|
|
|
|
|
|
onSubmit={handleSubmit(onSubmit)}>
|
|
|
|
|
|
|
|
<p>Find</p>
|
|
|
|
<p>Find</p>
|
|
|
|
<div className=" space-x-2">
|
|
|
|
<div className=" space-x-2">
|
|
|
|
<Select
|
|
|
|
<Select
|
|
|
|
// {...register('questionType')}
|
|
|
|
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
label="Type"
|
|
|
|
label="Type"
|
|
|
|
options={[
|
|
|
|
options={[
|
|
|
@ -52,12 +67,12 @@ export default function LandingPage() {
|
|
|
|
value: 'system design',
|
|
|
|
value: 'system design',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
value="coding"
|
|
|
|
value={landingQueryData.questionType}
|
|
|
|
|
|
|
|
onChange={handleChangeType}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<p>questions from</p>
|
|
|
|
<p>questions from</p>
|
|
|
|
<Select
|
|
|
|
<Select
|
|
|
|
// {...register('company')}
|
|
|
|
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
label="Company"
|
|
|
|
label="Company"
|
|
|
|
options={[
|
|
|
|
options={[
|
|
|
@ -74,13 +89,13 @@ export default function LandingPage() {
|
|
|
|
value: 'amazon',
|
|
|
|
value: 'amazon',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
value="google"
|
|
|
|
value={landingQueryData.company}
|
|
|
|
|
|
|
|
onChange={handleChangeCompany}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<p>in</p>
|
|
|
|
<p>in</p>
|
|
|
|
<Select
|
|
|
|
<Select
|
|
|
|
// {...register('location')}
|
|
|
|
|
|
|
|
isLabelHidden={true}
|
|
|
|
isLabelHidden={true}
|
|
|
|
label="Select a category"
|
|
|
|
label="Location"
|
|
|
|
options={[
|
|
|
|
options={[
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Singapore',
|
|
|
|
label: 'Singapore',
|
|
|
@ -95,13 +110,14 @@ export default function LandingPage() {
|
|
|
|
value: 'menlo park',
|
|
|
|
value: 'menlo park',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
]}
|
|
|
|
value="singapore"
|
|
|
|
value={landingQueryData.location}
|
|
|
|
|
|
|
|
onChange={handleChangeLocation}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
<Button
|
|
|
|
label="Go"
|
|
|
|
label="Go"
|
|
|
|
variant="primary"
|
|
|
|
variant="primary"
|
|
|
|
onClick={handleSubmit(onSubmit)}></Button>
|
|
|
|
onClick={() => handleLandingQuery(landingQueryData)}></Button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<p className="py-20 text-center">CAROUSELL PLACEHOLDER</p>
|
|
|
|
<p className="py-20 text-center">CAROUSELL PLACEHOLDER</p>
|
|
|
|
</div>
|
|
|
|
</div>
|