import * as React from "react"; import { useState } from "react"; import { About, IAboutProps } from "../../components/About"; import { Contacts, IContactsProps } from "../../components/Contacts"; import { Form } from "../../components/Form"; import { Image } from "../../components/Image"; import { IVideoProps, Video } from "../../components/Video"; import { Loading, LoadingType } from "../../components/Loading"; import { Link } from "../../components/Link"; import { Pin, PinType } from "../../components/Pin"; import { getImageSrc } from "../../utilities/image"; interface IPhotographerPromoProps { about: IAboutProps, contacts: IContactsProps; imagePrefix?: string; // TODO: This only requires src from IVideoProps video?: IVideoProps; /** * If provided, a
will be rendered for booking * a photographer */ book?: (data: any) => Promise; } export const PhotographerPromo = ({ about, contacts, imagePrefix, video, book, }: IPhotographerPromoProps) => { const [booked, setBooked] = useState<"booking" | "booked" | "failed-book" | null>(null); return (
Welcome to Aircam
{video && (
)}
Get a professional photographer
$99 for 90 mins
{book && (
{booked === "booking" && } {booked === "booked" && ( <>
Thank you. We will be in touch!
)} {booked === "failed-book" && ( <>
Something went wrong!
)} {!booked && ( <>
Request a photographer
{ try { setBooked("booking"); await book(data); setBooked("booked"); } catch (e) { setBooked("failed-book"); } }} inputs={[ { id: "photographer-email", supertext: "Email", type: "email", placeholder: "Enter your email", required: true, } ]} submit={{ text: "Book" }} /> )}
)} {!book && ( <>
Contact us via
)}
) }