diff --git a/src/app/(client-components)/(HeroSearchFormSmall)/HeroSearchFormSmall.tsx b/src/app/(client-components)/(HeroSearchFormSmall)/HeroSearchFormSmall.tsx new file mode 100644 index 0000000..168389e --- /dev/null +++ b/src/app/(client-components)/(HeroSearchFormSmall)/HeroSearchFormSmall.tsx @@ -0,0 +1,90 @@ +"use client"; + +import React, { FC, useEffect, useState } from "react"; +import { StaySearchFormFields } from "../type"; +import StaySearchForm from "./(stay-search-form)/StaySearchForm"; +import ExperiencesSearchForm from "./(experiences-search-form)/ExperiencesSearchForm"; +import RentalCarSearchForm from "./(car-search-form)/RentalCarSearchForm"; +import FlightSearchForm from "./(flight-search-form)/FlightSearchForm"; + +export type SearchTab = "Stays" | "Experiences" | "Cars" | "Flights"; + +export interface HeroSearchFormSmallProps { + className?: string; + defaultTab?: SearchTab; + onTabChange?: (tab: SearchTab) => void; + defaultFieldFocus?: StaySearchFormFields; +} +const TABS: SearchTab[] = ["Stays", "Experiences", "Cars", "Flights"]; + +const HeroSearchFormSmall: FC = ({ + className = "", + defaultTab = "Stays", + onTabChange, + defaultFieldFocus, +}) => { + const [tabActive, setTabActive] = useState(defaultTab); + + useEffect(() => { + setTabActive(defaultTab); + }, [defaultTab]); + + const renderTab = () => { + return ( + + ); + }; + + const renderForm = () => { + switch (tabActive) { + case "Stays": + return ; + case "Experiences": + return ; + case "Cars": + return ; + case "Flights": + return ; + + default: + return null; + } + }; + + return ( +
+ {renderTab()} +
{renderForm()}
+
+ ); +}; + +export default HeroSearchFormSmall;