[CAL-1095] Embed modal (floating pop up button) - UI/layout/spacing issues (#8217)

* [CAL-1095] Embed modal (floating pop up button) - UI/layout/spacing issues

* requested changes

---------

Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com>
Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
tweak/eslint-disable-exhaustive-deps^2
GitStart-Cal.com 2023-05-02 20:57:01 +02:00 committed by GitHub
parent 5672a721d9
commit 4f466fd95d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 279 additions and 275 deletions

View File

@ -1,5 +1,6 @@
import { Collapsible, CollapsibleContent } from "@radix-ui/react-collapsible"; import { Collapsible, CollapsibleContent } from "@radix-ui/react-collapsible";
import classNames from "classnames"; import classNames from "classnames";
import type { TFunction } from "next-i18next";
import type { NextRouter } from "next/router"; import type { NextRouter } from "next/router";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import type { MutableRefObject, RefObject } from "react"; import type { MutableRefObject, RefObject } from "react";
@ -21,11 +22,10 @@ import {
TextArea, TextArea,
TextField, TextField,
ColorPicker, ColorPicker,
Select,
} from "@calcom/ui"; } from "@calcom/ui";
import { Code, Trello, Sun, ArrowLeft } from "@calcom/ui/components/icon"; import { Code, Trello, Sun, ArrowLeft } from "@calcom/ui/components/icon";
import Select from "@components/ui/form/Select";
type EmbedType = "inline" | "floating-popup" | "element-click"; type EmbedType = "inline" | "floating-popup" | "element-click";
type EmbedFramework = "react" | "HTML"; type EmbedFramework = "react" | "HTML";
@ -305,190 +305,189 @@ const getEmbedTypeSpecificString = ({
return ""; return "";
}; };
const embeds: { const embeds = (t: TFunction) =>
illustration: React.ReactElement; (() => {
title: string; return [
subtitle: string; {
type: EmbedType; title: t("inline_embed"),
}[] = [ subtitle: t("load_inline_content"),
{ type: "inline",
title: "Inline Embed", illustration: (
subtitle: "Loads your event type directly inline with your other website content.", <svg
type: "inline", width="100%"
illustration: ( height="100%"
<svg className="rounded-md"
width="100%" viewBox="0 0 308 265"
height="100%" fill="none"
className="rounded-md" xmlns="http://www.w3.org/2000/svg">
viewBox="0 0 308 265" <path
fill="none" d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z"
xmlns="http://www.w3.org/2000/svg"> fill="white"
<path />
d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z" <rect x="24" width="260" height="38.5" rx="6" fill="#F3F4F6" />
fill="white" <rect x="24.5" y="51" width="139" height="163" rx="1.5" fill="#F8F8F8" />
/> <rect opacity="0.8" x="48" y="74.5" width="80" height="8" rx="6" fill="#F3F4F6" />
<rect x="24" width="260" height="38.5" rx="6" fill="#F3F4F6" /> <rect x="48" y="86.5" width="48" height="4" rx="6" fill="#F3F4F6" />
<rect x="24.5" y="51" width="139" height="163" rx="1.5" fill="#F8F8F8" /> <rect x="49" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect opacity="0.8" x="48" y="74.5" width="80" height="8" rx="6" fill="#F3F4F6" /> <rect x="61" y="99.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="48" y="86.5" width="48" height="4" rx="6" fill="#F3F4F6" /> <rect x="73" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="49" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="85" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="61" y="99.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="97" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="73" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="85" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="121" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="97" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="133" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="109" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="85" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="121" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="97" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="133" y="99.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="85" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="121" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="97" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="133" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="109" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="49" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="121" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="61" y="125.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="133" y="113.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <path
<rect x="49" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> d="M61 124.5H67V122.5H61V124.5ZM68 125.5V131.5H70V125.5H68ZM67 132.5H61V134.5H67V132.5ZM60 131.5V125.5H58V131.5H60ZM61 132.5C60.4477 132.5 60 132.052 60 131.5H58C58 133.157 59.3431 134.5 61 134.5V132.5ZM68 131.5C68 132.052 67.5523 132.5 67 132.5V134.5C68.6569 134.5 70 133.157 70 131.5H68ZM67 124.5C67.5523 124.5 68 124.948 68 125.5H70C70 123.843 68.6569 122.5 67 122.5V124.5ZM61 122.5C59.3431 122.5 58 123.843 58 125.5H60C60 124.948 60.4477 124.5 61 124.5V122.5Z"
<rect x="61" y="125.5" width="6" height="6" rx="1" fill="#3E3E3E" /> fill="#3E3E3E"
<path />
d="M61 124.5H67V122.5H61V124.5ZM68 125.5V131.5H70V125.5H68ZM67 132.5H61V134.5H67V132.5ZM60 131.5V125.5H58V131.5H60ZM61 132.5C60.4477 132.5 60 132.052 60 131.5H58C58 133.157 59.3431 134.5 61 134.5V132.5ZM68 131.5C68 132.052 67.5523 132.5 67 132.5V134.5C68.6569 134.5 70 133.157 70 131.5H68ZM67 124.5C67.5523 124.5 68 124.948 68 125.5H70C70 123.843 68.6569 122.5 67 122.5V124.5ZM61 122.5C59.3431 122.5 58 123.843 58 125.5H60C60 124.948 60.4477 124.5 61 124.5V122.5Z" <rect x="73" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
fill="#3E3E3E" <rect x="85" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
/> <rect x="97" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="73" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="85" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="121" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="97" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="133" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="109" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="49" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="121" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="61" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="133" y="125.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="73" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="49" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="85" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="61" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="97" y="137.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="73" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="137.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="85" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="121" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="97" y="137.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="133" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="109" y="137.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="49" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="121" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="61" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="133" y="137.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="73" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="49" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="85" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="61" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="97" y="149.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="73" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="149.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="85" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="121" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="97" y="149.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="133" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="109" y="149.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="49" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="121" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="61" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="133" y="149.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="73" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="49" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="85" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="61" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="97" y="161.5" width="6" height="6" rx="1" fill="#3E3E3E" />
<rect x="73" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="109" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" />
<rect x="85" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="24.5" y="51" width="139" height="163" rx="6" stroke="#292929" />
<rect x="97" y="161.5" width="6" height="6" rx="1" fill="#3E3E3E" /> <rect x="176" y="50.5" width="108" height="164" rx="6" fill="#F3F4F6" />
<rect x="109" y="161.5" width="6" height="6" rx="1" fill="#C6C6C6" /> <rect x="24" y="226.5" width="260" height="38.5" rx="6" fill="#F3F4F6" />
<rect x="24.5" y="51" width="139" height="163" rx="6" stroke="#292929" /> </svg>
<rect x="176" y="50.5" width="108" height="164" rx="6" fill="#F3F4F6" /> ),
<rect x="24" y="226.5" width="260" height="38.5" rx="6" fill="#F3F4F6" /> },
</svg> {
), title: t("floating_pop_up_button"),
}, subtitle: t("floating_button_trigger_modal"),
{ type: "floating-popup",
title: "Floating pop-up button", illustration: (
subtitle: "Adds a floating button on your site that launches Cal in a dialog.", <svg
type: "floating-popup", width="100%"
illustration: ( height="100%"
<svg className="rounded-md"
width="100%" viewBox="0 0 308 265"
height="100%" fill="none"
className="rounded-md" xmlns="http://www.w3.org/2000/svg">
viewBox="0 0 308 265" <path
fill="none" d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z"
xmlns="http://www.w3.org/2000/svg"> fill="white"
<path />
d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z" <rect x="24" width="260" height="38.5" rx="6" fill="#F3F4F6" />
fill="white" <rect x="24" y="50.5" width="120" height="76" rx="6" fill="#F3F4F6" />
/> <rect x="24" y="138.5" width="120" height="76" rx="6" fill="#F3F4F6" />
<rect x="24" width="260" height="38.5" rx="6" fill="#F3F4F6" /> <rect x="156" y="50.5" width="128" height="164" rx="6" fill="#F3F4F6" />
<rect x="24" y="50.5" width="120" height="76" rx="6" fill="#F3F4F6" /> <rect x="24" y="226.5" width="260" height="38.5" rx="6" fill="#F3F4F6" />
<rect x="24" y="138.5" width="120" height="76" rx="6" fill="#F3F4F6" /> <rect x="226" y="223.5" width="66" height="26" rx="6" fill="#292929" />
<rect x="156" y="50.5" width="128" height="164" rx="6" fill="#F3F4F6" /> <rect x="242" y="235.5" width="34" height="2" rx="1" fill="white" />
<rect x="24" y="226.5" width="260" height="38.5" rx="6" fill="#F3F4F6" /> </svg>
<rect x="226" y="223.5" width="66" height="26" rx="6" fill="#292929" /> ),
<rect x="242" y="235.5" width="34" height="2" rx="1" fill="white" /> },
</svg> {
), title: t("pop_up_element_click"),
}, subtitle: t("open_dialog_with_element_click"),
{ type: "element-click",
title: "Pop up via element click", illustration: (
subtitle: "Open your Cal dialog when someone clicks an element.", <svg
type: "element-click", width="100%"
illustration: ( height="100%"
<svg className="rounded-md"
width="100%" viewBox="0 0 308 265"
height="100%" fill="none"
className="rounded-md" xmlns="http://www.w3.org/2000/svg">
viewBox="0 0 308 265" <path
fill="none" d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z"
xmlns="http://www.w3.org/2000/svg"> fill="white"
<path />
d="M0 1.99999C0 0.895423 0.895431 0 2 0H306C307.105 0 308 0.895431 308 2V263C308 264.105 307.105 265 306 265H2C0.895431 265 0 264.105 0 263V1.99999Z" <rect x="24" y="0.50293" width="260" height="24" rx="6" fill="#F3F4F6" />
fill="white" <rect x="24" y="35" width="259" height="192" rx="5.5" fill="#F9FAFB" />
/> <g filter="url(#filter0_i_3223_14162)">
<rect x="24" y="0.50293" width="260" height="24" rx="6" fill="#F3F4F6" /> <rect opacity="0.8" x="40" y="99" width="24" height="24" rx="2" fill="#E5E7EB" />
<rect x="24" y="35" width="259" height="192" rx="5.5" fill="#F9FAFB" /> <rect x="40" y="127" width="48" height="8" rx="1" fill="#E5E7EB" />
<g filter="url(#filter0_i_3223_14162)"> <rect x="40" y="139" width="82" height="8" rx="1" fill="#E5E7EB" />
<rect opacity="0.8" x="40" y="99" width="24" height="24" rx="2" fill="#E5E7EB" /> <rect x="40" y="151" width="34" height="4" rx="1" fill="#E5E7EB" />
<rect x="40" y="127" width="48" height="8" rx="1" fill="#E5E7EB" /> <rect x="40" y="159" width="34" height="4" rx="1" fill="#E5E7EB" />
<rect x="40" y="139" width="82" height="8" rx="1" fill="#E5E7EB" /> </g>
<rect x="40" y="151" width="34" height="4" rx="1" fill="#E5E7EB" /> <rect x="152" y="48" width="2" height="169" rx="2" fill="#E5E7EB" />
<rect x="40" y="159" width="34" height="4" rx="1" fill="#E5E7EB" />
</g> <rect opacity="0.8" x="176" y="84" width="80" height="8" rx="2" fill="#E5E7EB" />
<rect x="152" y="48" width="2" height="169" rx="2" fill="#E5E7EB" /> <rect x="176" y="96" width="48" height="4" rx="1" fill="#E5E7EB" />
<rect x="177" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="109" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="201" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="135" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="187.3" y="133.4" width="9" height="9" rx="1.5" stroke="#0D121D" />
<rect x="201" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="147" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="147" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="249" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="159" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="159" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="249" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="171" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="24" y="35" width="259" height="192" rx="5.5" stroke="#101010" />
<rect x="24" y="241.503" width="260" height="24" rx="6" fill="#F3F4F6" />
</svg>
),
},
];
})();
<rect opacity="0.8" x="176" y="84" width="80" height="8" rx="2" fill="#E5E7EB" />
<rect x="176" y="96" width="48" height="4" rx="1" fill="#E5E7EB" />
<rect x="177" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="109" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="201" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="109" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="123" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="135" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="187.3" y="133.4" width="9" height="9" rx="1.5" stroke="#0D121D" />
<rect x="201" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="237" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="249" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="135" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="147" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="147" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="249" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="147" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="159" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="159" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="249" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="261" y="159" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="177" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="189" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="201" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="213" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="225" y="171" width="6" height="6" rx="1" fill="#0D121D" />
<rect x="237" y="171" width="6" height="6" rx="1" fill="#E5E7EB" />
<rect x="24" y="35" width="259" height="192" rx="5.5" stroke="#101010" />
<rect x="24" y="241.503" width="260" height="24" rx="6" fill="#F3F4F6" />
</svg>
),
},
];
const tabs = [ const tabs = [
{ {
name: "HTML", name: "HTML",
@ -534,11 +533,7 @@ ${getEmbedTypeSpecificString({ embedFramework: "HTML", embedType, calLink, previ
<!-- Cal ${embedType} embed code ends -->` <!-- Cal ${embedType} embed code ends -->`
} }
/> />
<p className="text-subtle hidden text-sm"> <p className="text-subtle hidden text-sm">{t("need_help_embedding")}</p>
{t(
"Need help? See our guides for embedding Cal on Wix, Squarespace, or WordPress, check our common questions, or explore advanced embed options."
)}
</p>
</> </>
); );
}), }),
@ -622,7 +617,7 @@ Cal("init", {origin:"${WEBAPP_URL}"});
const ThemeSelectControl = ({ children, ...props }: ControlProps<{ value: Theme; label: string }, false>) => { const ThemeSelectControl = ({ children, ...props }: ControlProps<{ value: Theme; label: string }, false>) => {
return ( return (
<components.Control {...props}> <components.Control {...props}>
<Sun className="text-subtle ml-2 h-4 w-4" /> <Sun className="text-subtle mr-2 h-4 w-4" />
{children} {children}
</components.Control> </components.Control>
); );
@ -642,7 +637,7 @@ const ChooseEmbedTypesDialogContent = () => {
</div> </div>
</div> </div>
<div className="items-start space-y-2 md:flex md:space-y-0"> <div className="items-start space-y-2 md:flex md:space-y-0">
{embeds.map((embed, index) => ( {embeds(t).map((embed, index) => (
<button <button
className="hover:bg-subtle bg-muted w-full rounded-md border border-transparent p-6 text-left hover:rounded-md ltr:mr-4 ltr:last:mr-0 rtl:ml-4 rtl:last:ml-0 lg:w-1/3" className="hover:bg-subtle bg-muted w-full rounded-md border border-transparent p-6 text-left hover:rounded-md ltr:mr-4 ltr:last:mr-0 rtl:ml-4 rtl:last:ml-0 lg:w-1/3"
key={index} key={index}
@ -692,7 +687,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
}); });
const refOfEmbedCodesRefs = useRef(embedCodeRefs); const refOfEmbedCodesRefs = useRef(embedCodeRefs);
const embed = embeds.find((embed) => embed.type === embedType); const embed = embeds(t).find((embed) => embed.type === embedType);
const [isEmbedCustomizationOpen, setIsEmbedCustomizationOpen] = useState(true); const [isEmbedCustomizationOpen, setIsEmbedCustomizationOpen] = useState(true);
const [isBookingCustomizationOpen, setIsBookingCustomizationOpen] = useState(true); const [isBookingCustomizationOpen, setIsBookingCustomizationOpen] = useState(true);
@ -806,11 +801,11 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
const FloatingPopupPositionOptions = [ const FloatingPopupPositionOptions = [
{ {
value: "bottom-right", value: "bottom-right",
label: "Bottom Right", label: "Bottom right",
}, },
{ {
value: "bottom-left", value: "bottom-left",
label: "Bottom Left", label: "Bottom left",
}, },
]; ];
@ -834,7 +829,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
</button> </button>
{embed.title} {embed.title}
</h3> </h3>
<h4 className="text-emphasis mb-6 text-sm font-normal">{embed.subtitle}</h4> <h4 className="text-subtle mb-6 text-sm font-normal">{embed.subtitle}</h4>
<div className="flex flex-col"> <div className="flex flex-col">
<div className={classNames("font-medium", embedType === "element-click" ? "hidden" : "")}> <div className={classNames("font-medium", embedType === "element-click" ? "hidden" : "")}>
<Collapsible <Collapsible
@ -844,7 +839,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
<div className={classNames(embedType === "inline" ? "block" : "hidden")}> <div className={classNames(embedType === "inline" ? "block" : "hidden")}>
{/*TODO: Add Auto/Fixed toggle from Figma */} {/*TODO: Add Auto/Fixed toggle from Figma */}
<div className="text-default mb-[9px] text-sm">Window sizing</div> <div className="text-default mb-[9px] text-sm">Window sizing</div>
<div className="justify-left flex items-center !font-normal"> <div className="justify-left mb-6 flex items-center !font-normal ">
<div className="mr-[9px]"> <div className="mr-[9px]">
<TextField <TextField
labelProps={{ className: "hidden" }} labelProps={{ className: "hidden" }}
@ -892,10 +887,10 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
</div> </div>
<div <div
className={classNames( className={classNames(
"mt-4 items-center justify-between", "items-center justify-between",
embedType === "floating-popup" ? "text-emphasis" : "hidden" embedType === "floating-popup" ? "text-emphasis" : "hidden"
)}> )}>
<div className="mb-2 text-sm">Button Text</div> <div className="mb-2 text-sm">Button text</div>
{/* Default Values should come from preview iframe */} {/* Default Values should come from preview iframe */}
<TextField <TextField
labelProps={{ className: "hidden" }} labelProps={{ className: "hidden" }}
@ -910,7 +905,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
}; };
}); });
}} }}
defaultValue="Book my Cal" defaultValue={t("book_my_cal")}
required required
/> />
</div> </div>
@ -935,14 +930,14 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
}); });
}} }}
/> />
<div className="text-default text-sm">Display Calendar Icon Button</div> <div className="text-default my-2 text-sm">Display calendar icon</div>
</div> </div>
<div <div
className={classNames( className={classNames(
"mt-4 items-center justify-between", "mt-4 items-center justify-between",
embedType === "floating-popup" ? "text-emphasis" : "hidden" embedType === "floating-popup" ? "text-emphasis" : "hidden"
)}> )}>
<div className="mb-2">Position of Button</div> <div className="mb-2">Position of button</div>
<Select <Select
onChange={(position) => { onChange={(position) => {
setPreviewState((previewState) => { setPreviewState((previewState) => {
@ -959,54 +954,50 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
options={FloatingPopupPositionOptions} options={FloatingPopupPositionOptions}
/> />
</div> </div>
<div <div className="mt-3 flex flex-col xl:flex-row xl:justify-between">
className={classNames( <div className={classNames("mt-4", embedType === "floating-popup" ? "" : "hidden")}>
"mt-4", <div className="whitespace-nowrap">Button color</div>
embedType === "floating-popup" ? "text-emphasis" : "hidden" <div className="mt-2 w-40 xl:mt-0 xl:w-full">
)}> <ColorPicker
<div>Button Color</div> className="w-[130px]"
<div className="w-full"> popoverAlign="start"
<ColorPicker container={dialogContentRef?.current ?? undefined}
popoverAlign="start" defaultValue="#000000"
container={dialogContentRef?.current ?? undefined} onChange={(color) => {
defaultValue="#000000" setPreviewState((previewState) => {
onChange={(color) => { return {
setPreviewState((previewState) => { ...previewState,
return { floatingPopup: {
...previewState, ...previewState.floatingPopup,
floatingPopup: { buttonColor: color,
...previewState.floatingPopup, },
buttonColor: color, };
}, });
}; }}
}); />
}} </div>
/>
</div> </div>
</div> <div className={classNames("mt-4", embedType === "floating-popup" ? "" : "hidden")}>
<div <div className="whitespace-nowrap">Text color</div>
className={classNames( <div className="mt-2 mb-6 w-40 xl:mt-0 xl:w-full">
"mt-4", <ColorPicker
embedType === "floating-popup" ? "text-emphasis" : "hidden" className="w-[130px]"
)}> popoverAlign="start"
<div>Text Color</div> container={dialogContentRef?.current ?? undefined}
<div className="w-full"> defaultValue="#000000"
<ColorPicker onChange={(color) => {
popoverAlign="start" setPreviewState((previewState) => {
container={dialogContentRef?.current ?? undefined} return {
defaultValue="#000000" ...previewState,
onChange={(color) => { floatingPopup: {
setPreviewState((previewState) => { ...previewState.floatingPopup,
return { buttonTextColor: color,
...previewState, },
floatingPopup: { };
...previewState.floatingPopup, });
buttonTextColor: color, }}
}, />
}; </div>
});
}}
/>
</div> </div>
</div> </div>
</CollapsibleContent> </CollapsibleContent>
@ -1017,7 +1008,30 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
open={isBookingCustomizationOpen} open={isBookingCustomizationOpen}
onOpenChange={() => setIsBookingCustomizationOpen((val) => !val)}> onOpenChange={() => setIsBookingCustomizationOpen((val) => !val)}>
<CollapsibleContent> <CollapsibleContent>
<div className="mt-6 text-sm"> <div className="text-sm">
<Label className="mb-6">
<div className="mb-2">Theme</div>
<Select
className="w-full"
defaultValue={ThemeOptions[0]}
components={{
Control: ThemeSelectControl,
IndicatorSeparator: () => null,
}}
onChange={(option) => {
if (!option) {
return;
}
setPreviewState((previewState) => {
return {
...previewState,
theme: option.value,
};
});
}}
options={ThemeOptions}
/>
</Label>
<div className="mb-6 flex items-center justify-start space-x-2 rtl:space-x-reverse"> <div className="mb-6 flex items-center justify-start space-x-2 rtl:space-x-reverse">
<Switch <Switch
checked={previewState.hideEventTypeDetails} checked={previewState.hideEventTypeDetails}
@ -1056,29 +1070,6 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
</div> </div>
</Label> </Label>
))} ))}
<Label>
<div className="mb-2">Theme</div>
<Select
className="w-full"
defaultValue={ThemeOptions[0]}
components={{
Control: ThemeSelectControl,
IndicatorSeparator: () => null,
}}
onChange={(option) => {
if (!option) {
return;
}
setPreviewState((previewState) => {
return {
...previewState,
theme: option.value,
};
});
}}
options={ThemeOptions}
/>
</Label>
</div> </div>
</CollapsibleContent> </CollapsibleContent>
</Collapsible> </Collapsible>

View File

@ -1800,5 +1800,13 @@
"payment_app_commission": "Require payment ({{paymentFeePercentage}}% + {{fee, currency}} commission per transaction)", "payment_app_commission": "Require payment ({{paymentFeePercentage}}% + {{fee, currency}} commission per transaction)",
"email_invite_team": "{{email}} has been invited", "email_invite_team": "{{email}} has been invited",
"error_collecting_card": "Error collecting card", "error_collecting_card": "Error collecting card",
"image_size_limit_exceed": "Uploaded image shouldn't exceed 5mb size limit" "image_size_limit_exceed": "Uploaded image shouldn't exceed 5mb size limit",
"inline_embed": "Inline Embed",
"load_inline_content": "Loads your event type directly inline with your other website content.",
"floating_pop_up_button": "Floating pop-up button",
"floating_button_trigger_modal": "Puts a floating button on your site that triggers a modal with your event type.",
"pop_up_element_click": "Pop up via element click",
"open_dialog_with_element_click": "Open your Cal dialog when someone clicks an element.",
"need_help_embedding": "Need help? See our guides for embedding Cal on Wix, Squarespace, or WordPress, check our common questions, or explore advanced embed options.",
"book_my_cal": "Book my Cal"
} }

View File

@ -2,6 +2,7 @@ import * as Popover from "@radix-ui/react-popover";
import { useState } from "react"; import { useState } from "react";
import { HexColorInput, HexColorPicker } from "react-colorful"; import { HexColorInput, HexColorPicker } from "react-colorful";
import cx from "@calcom/lib/classNames";
import { fallBackHex, isValidHexCode } from "@calcom/lib/getBrandColours"; import { fallBackHex, isValidHexCode } from "@calcom/lib/getBrandColours";
export type ColorPickerProps = { export type ColorPickerProps = {
@ -9,6 +10,7 @@ export type ColorPickerProps = {
onChange: (text: string) => void; onChange: (text: string) => void;
container?: HTMLElement; container?: HTMLElement;
popoverAlign?: React.ComponentProps<typeof Popover.Content>["align"]; popoverAlign?: React.ComponentProps<typeof Popover.Content>["align"];
className?: string;
}; };
const ColorPicker = (props: ColorPickerProps) => { const ColorPicker = (props: ColorPickerProps) => {
@ -44,7 +46,10 @@ const ColorPicker = (props: ColorPickerProps) => {
</Popover.Root> </Popover.Root>
<HexColorInput <HexColorInput
className="border-default text-default bg-default block h-full w-full border px-3 py-2 ltr:rounded-r-md rtl:rounded-l-md sm:text-sm" className={cx(
"border-default text-default bg-default block h-full w-full border px-3 py-2 ltr:rounded-r-md rtl:rounded-l-md sm:text-sm",
props.className
)}
color={color} color={color}
onChange={(val) => { onChange={(val) => {
setColor(val); setColor(val);