feat: BookerEmbed atom (#15689)
* init: booker embed atom * update booker platform wrapper * export booker embed for atoms * update booker embed wrapper * fixup: refresh url not needed * rename booker embed * add global styles * export not needed * add booker embed atoms in examples app * fixup * fixup! fixup * fixup! fixup! fixup --------- Co-authored-by: Rajiv Sahal <[email protected]> Co-authored-by: Morgan Vernay <[email protected]> Co-authored-by: Morgan <[email protected]>
This commit is contained in:
8 files changed
+68
-2
No files matched your search
@@ -28,6 +28,9 @@ export function Navbar({ username }: { username?: string }) {
|
||||
<li>
|
||||
<Link href="/bookings">My Bookings</Link>
|
||||
</li>
|
||||
<li>
|
||||
<Link href="/embed">Embed</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import "@/styles/globals.css";
|
||||
import type { AppProps } from "next/app";
|
||||
import { Poppins } from "next/font/google";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { CalProvider } from "@calcom/atoms";
|
||||
import { CalProvider, BookerEmbed } from "@calcom/atoms";
|
||||
import "@calcom/atoms/globals.min.css";
|
||||
|
||||
const poppins = Poppins({ subsets: ["latin"], weight: ["400", "800"] });
|
||||
@@ -25,6 +27,8 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
const [accessToken, setAccessToken] = useState("");
|
||||
const [email, setUserEmail] = useState("");
|
||||
const [username, setUsername] = useState("");
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
|
||||
useEffect(() => {
|
||||
const randomEmail = generateRandomEmail();
|
||||
@@ -59,6 +63,30 @@ export default function App({ Component, pageProps }: AppProps) {
|
||||
</>
|
||||
)}
|
||||
</CalProvider>{" "}
|
||||
{pathname === "/embed" && (
|
||||
<div>
|
||||
<BookerEmbed
|
||||
customClassNames={{
|
||||
bookerContainer: "!bg-[#F5F2FE] [&_button:!rounded-full] border-subtle border",
|
||||
datePickerCustomClassNames: {
|
||||
datePickerDatesActive: "!bg-[#D7CEF5]",
|
||||
},
|
||||
eventMetaCustomClassNames: {
|
||||
eventMetaTitle: "text-[#7151DC]",
|
||||
},
|
||||
availableTimeSlotsCustomClassNames: {
|
||||
availableTimeSlotsHeaderContainer: "!bg-[#F5F2FE]",
|
||||
availableTimes: "!bg-[#D7CEF5]",
|
||||
},
|
||||
}}
|
||||
username={username}
|
||||
eventSlug="thirty-minutes"
|
||||
onCreateBookingSuccess={(data) => {
|
||||
router.push(`/${data.data.uid}`);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Navbar } from "@/components/Navbar";
|
||||
import { Inter } from "next/font/google";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export default function Embed(props: { calUsername: string; calEmail: string }) {
|
||||
return (
|
||||
<main className={`flex ${inter.className} text-default flex flex-col`}>
|
||||
<Navbar username={props.calUsername} />
|
||||
<div>
|
||||
<h1 className="mx-8 my-4 text-2xl font-bold">This is the booker embed</h1>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user