diff --git a/src/assets/images/car-body-type/coupe.webp b/src/assets/images/car-body-type/coupe.webp new file mode 100644 index 0000000..7dc7e75 Binary files /dev/null and b/src/assets/images/car-body-type/coupe.webp differ diff --git a/src/assets/images/car-body-type/crossover.webp b/src/assets/images/car-body-type/crossover.webp new file mode 100644 index 0000000..5cf09a7 Binary files /dev/null and b/src/assets/images/car-body-type/crossover.webp differ diff --git a/src/assets/images/car-body-type/hatchback.webp b/src/assets/images/car-body-type/hatchback.webp new file mode 100644 index 0000000..d5778b5 Binary files /dev/null and b/src/assets/images/car-body-type/hatchback.webp differ diff --git a/src/assets/images/car-body-type/index.ts b/src/assets/images/car-body-type/index.ts new file mode 100644 index 0000000..81bda6c --- /dev/null +++ b/src/assets/images/car-body-type/index.ts @@ -0,0 +1,10 @@ +export { default as CoupeImg } from './coupe.webp'; +export { default as CrossoverImg } from './crossover.webp'; +export { default as HatchbackImg } from './hatchback.webp'; +export { default as LiftbackImg } from './liftback.webp'; +export { default as MinivanImg } from './minivan.webp'; +export { default as PickupImg } from './pickup.webp'; +export { default as SedanImg } from './sedan.webp'; +export { default as SportsCarImg } from './sports-car.webp'; +export { default as StationWagonImg } from './station-wagon.webp'; +export { default as SuvImg } from './suv.webp'; \ No newline at end of file diff --git a/src/assets/images/car-body-type/liftback.webp b/src/assets/images/car-body-type/liftback.webp new file mode 100644 index 0000000..051bf62 Binary files /dev/null and b/src/assets/images/car-body-type/liftback.webp differ diff --git a/src/assets/images/car-body-type/minivan.webp b/src/assets/images/car-body-type/minivan.webp new file mode 100644 index 0000000..46afe00 Binary files /dev/null and b/src/assets/images/car-body-type/minivan.webp differ diff --git a/src/assets/images/car-body-type/pickup.webp b/src/assets/images/car-body-type/pickup.webp new file mode 100644 index 0000000..d53c805 Binary files /dev/null and b/src/assets/images/car-body-type/pickup.webp differ diff --git a/src/assets/images/car-body-type/sedan.webp b/src/assets/images/car-body-type/sedan.webp new file mode 100644 index 0000000..d84b0e2 Binary files /dev/null and b/src/assets/images/car-body-type/sedan.webp differ diff --git a/src/assets/images/car-body-type/sports-car.webp b/src/assets/images/car-body-type/sports-car.webp new file mode 100644 index 0000000..f404c0f Binary files /dev/null and b/src/assets/images/car-body-type/sports-car.webp differ diff --git a/src/assets/images/car-body-type/station-wagon.webp b/src/assets/images/car-body-type/station-wagon.webp new file mode 100644 index 0000000..c4d7ab3 Binary files /dev/null and b/src/assets/images/car-body-type/station-wagon.webp differ diff --git a/src/assets/images/car-body-type/suv.webp b/src/assets/images/car-body-type/suv.webp new file mode 100644 index 0000000..8282f0e Binary files /dev/null and b/src/assets/images/car-body-type/suv.webp differ diff --git a/src/assets/images/index.ts b/src/assets/images/index.ts index 9e009f9..7297968 100644 --- a/src/assets/images/index.ts +++ b/src/assets/images/index.ts @@ -1 +1,2 @@ +export * from './car-body-type'; export { default as DemoVideoPosterImg } from './demo-video-poster.webp'; \ No newline at end of file diff --git a/src/components/order-form/form/car-body/car-body-select.tsx b/src/components/order-form/form/car-body/car-body-select.tsx index ca3f068..309958f 100644 --- a/src/components/order-form/form/car-body/car-body-select.tsx +++ b/src/components/order-form/form/car-body/car-body-select.tsx @@ -1,23 +1,92 @@ -import React, { forwardRef } from 'react'; -import { Select, SelectProps } from '@chakra-ui/react'; +import React, { forwardRef, useState } from 'react'; +import { + Input, + Image, + InputProps, + Box, + Popover, + PopoverAnchor, + PopoverContent, + PopoverBody, + List, + ListItem, +} from '@chakra-ui/react'; import { useTranslation } from 'react-i18next'; import { carBodySelectOptions } from './helper'; +import { CarBodySelectOption } from './types'; -export const CarBodySelect = forwardRef( +export const CarBodySelect = forwardRef( function CarBodySelect(props, ref) { + const [selected, setSelected] = useState>({}); + const handleOptionClick = (option: CarBodySelectOption) => { + setSelected(option); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + props.onChange(option.value); + }; + + const [isDropdownOpen, setIsDropdownOpen] = useState(false); + const { t } = useTranslation('~', { keyPrefix: 'dry-wash.order-create.car-body-select', }); return ( - + + + + setIsDropdownOpen(true)} + onBlur={() => setIsDropdownOpen(false)} + placeholder={t('placeholder')} + /> + + + + + {carBodySelectOptions.map((option) => ( + handleOptionClick(option)} + > + + {t(`options.${option.labelTKey}`)} + + ))} + + + + + ); }, ); diff --git a/src/components/order-form/form/car-body/helper.ts b/src/components/order-form/form/car-body/helper.ts index d906122..7b62c4e 100644 --- a/src/components/order-form/form/car-body/helper.ts +++ b/src/components/order-form/form/car-body/helper.ts @@ -1,3 +1,15 @@ +import { + CoupeImg, + CrossoverImg, + HatchbackImg, + LiftbackImg, + MinivanImg, + PickupImg, + SedanImg, + SportsCarImg, + StationWagonImg, + SuvImg +} from "../../../../assets/images"; import { Car } from "../../../../models/landing"; import { CarBodySelectOption } from "./types"; @@ -5,43 +17,53 @@ import { CarBodySelectOption } from "./types"; export const carBodySelectOptions: CarBodySelectOption[] = [ { value: Car.BodyStyle.SEDAN, - labelTKey: 'sedan' + labelTKey: 'sedan', + img: SedanImg }, { value: Car.BodyStyle.HATCHBACK, - labelTKey: 'hatchback' + labelTKey: 'hatchback', + img: HatchbackImg }, { value: Car.BodyStyle.CROSSOVER, - labelTKey: 'crossover' + labelTKey: 'crossover', + img: CrossoverImg }, { value: Car.BodyStyle.SUV, - labelTKey: 'suv' + labelTKey: 'suv', + img: SuvImg }, { value: Car.BodyStyle.STATION_WAGON, - labelTKey: 'station-wagon' + labelTKey: 'station-wagon', + img: StationWagonImg }, { value: Car.BodyStyle.COUPE, - labelTKey: 'coupe' + labelTKey: 'coupe', + img: CoupeImg }, { value: Car.BodyStyle.MINIVAN, - labelTKey: 'minivan' + labelTKey: 'minivan', + img: MinivanImg }, { value: Car.BodyStyle.PICKUP, - labelTKey: 'pickup' + labelTKey: 'pickup', + img: PickupImg }, { value: Car.BodyStyle.LIFTBACK, - labelTKey: 'liftback' + labelTKey: 'liftback', + img: LiftbackImg }, { value: Car.BodyStyle.SPORTS_CAR, - labelTKey: 'sports-car' + labelTKey: 'sports-car', + img: SportsCarImg }, { value: Car.BodyStyle.OTHER, diff --git a/src/components/order-form/form/car-body/types.ts b/src/components/order-form/form/car-body/types.ts index 926719f..d8dd708 100644 --- a/src/components/order-form/form/car-body/types.ts +++ b/src/components/order-form/form/car-body/types.ts @@ -14,4 +14,5 @@ export type CarBodySelectOption = { 'liftback' | 'sports-car' | 'other'; + img?: string; };