Scheduling infrastructure for absolutely everyone.
[CAL-1094] Embed modal / Inline - UI/Layout/Spacing issues (#7350)
GitStart-Cal.com13a53c020b33
diff --git a/apps/web/components/Embed.tsx b/apps/web/components/Embed.tsxindex 4d5a45f3e0b..8112a388473 100644--- a/apps/web/components/Embed.tsx+++ b/apps/web/components/Embed.tsx@@ -1,4 +1,4 @@-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@radix-ui/react-collapsible";+import { Collapsible, CollapsibleContent } from "@radix-ui/react-collapsible";import classNames from "classnames";import type { NextRouter } from "next/router";import { useRouter } from "next/router";@@ -22,7 +22,7 @@ import {TextField,ColorPicker,} from "@calcom/ui";-import { FiCode, FiTrello, FiSun, FiArrowLeft, FiChevronRight } from "@calcom/ui/components/icon";+import { FiCode, FiTrello, FiSun, FiArrowLeft } from "@calcom/ui/components/icon";import Select from "@components/ui/form/Select";@@ -313,7 +313,7 @@ const embeds: {}[] = [{title: "Inline Embed",- subtitle: "Loads your Cal scheduling page directly inline with your other website content",+ subtitle: "Loads your event type directly inline with your other website content.",type: "inline",illustration: (<svg@@ -798,7 +798,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({}const ThemeOptions = [- { value: Theme.auto, label: "Auto Theme" },+ { value: Theme.auto, label: "Auto" },{ value: Theme.dark, label: "Dark Theme" },{ value: Theme.light, label: "Light Theme" },];@@ -815,11 +815,18 @@ const EmbedTypeCodeAndPreviewDialogContent = ({];return (- <DialogContent ref={dialogContentRef} size="xl" className="p-0.5" type="creation">+ <DialogContent+ ref={dialogContentRef}+ className="rounded-lg p-0.5 sm:max-w-[80rem]"+ enableOverflow+ type="creation"><div className="flex"><div className="flex w-1/3 flex-col bg-gray-50 p-8">- <h3 className="mb-2 flex text-xl font-bold leading-6 text-gray-900" id="modal-title">+ <h3+ className="mb-2.5 flex items-center text-xl font-semibold leading-5 text-gray-900"+ id="modal-title"><button+ className="h-6 w-6"onClick={() => {removeQueryParams(router, ["embedType", "embedTabName"]);}}>@@ -827,55 +834,43 @@ const EmbedTypeCodeAndPreviewDialogContent = ({</button>{embed.title}</h3>- <hr className={classNames("mt-4", embedType === "element-click" ? "hidden" : "")} />- <div className="flex flex-col overflow-y-auto">- <div className={classNames("mt-4 font-medium", embedType === "element-click" ? "hidden" : "")}>+ <h4 className="mb-6 text-sm font-normal text-gray-500">{embed.subtitle}</h4>+ <div className="flex flex-col">+ <div className={classNames("font-medium", embedType === "element-click" ? "hidden" : "")}><Collapsibleopen={isEmbedCustomizationOpen}onOpenChange={() => setIsEmbedCustomizationOpen((val) => !val)}>- <CollapsibleTrigger- type="button"- className="flex w-full items-center text-base font-medium text-gray-900">- <div>- {embedType === "inline"- ? "Inline Embed Customization"- : embedType === "floating-popup"- ? "Floating Popup Customization"- : "Element Click Customization"}- </div>- <FiChevronRight- className={`${- isEmbedCustomizationOpen ? "rotate-90 transform" : ""- } ml-auto h-5 w-5 text-gray-500`}- />- </CollapsibleTrigger><CollapsibleContent className="text-sm">- <div className={classNames("mt-6", embedType === "inline" ? "block" : "hidden")}>+ <div className={classNames(embedType === "inline" ? "block" : "hidden")}>{/*TODO: Add Auto/Fixed toggle from Figma */}- <div className="text-sm">Embed Window Sizing</div>- <div className="justify-left flex items-center">- <TextField- labelProps={{ className: "hidden" }}- required- value={previewState.inline.width}- onChange={(e) => {- setPreviewState((previewState) => {- const width = e.target.value || "100%";+ <div className="mb-[9px] text-sm">Window sizing</div>+ <div className="justify-left flex items-center !font-normal">+ <div className="mr-[9px]">+ <TextField+ labelProps={{ className: "hidden" }}+ className="focus:ring-offset-0"+ required+ value={previewState.inline.width}+ onChange={(e) => {+ setPreviewState((previewState) => {+ const width = e.target.value || "100%";++ return {+ ...previewState,+ inline: {+ ...previewState.inline,+ width,+ },+ };+ });+ }}+ addOnLeading={<>W</>}+ />+ </div>- return {- ...previewState,- inline: {- ...previewState.inline,- width,- },- };- });- }}- addOnLeading={<>W</>}- />- <span className="p-2">×</span><TextFieldlabelProps={{ className: "hidden" }}+ className="focus:ring-offset-0"value={previewState.inline.height}requiredonChange={(e) => {@@ -1007,22 +1002,13 @@ const EmbedTypeCodeAndPreviewDialogContent = ({</CollapsibleContent></Collapsible></div>- <hr className="mt-4" />- <div className="mt-4 font-medium">+ <div className="font-medium"><Collapsibleopen={isBookingCustomizationOpen}onOpenChange={() => setIsBookingCustomizationOpen((val) => !val)}>- <CollapsibleTrigger className="flex w-full" type="button">- <div className="text-base font-medium text-gray-900">Cal Booking Customization</div>- <FiChevronRight- className={`${- isBookingCustomizationOpen ? "rotate-90 transform" : ""- } ml-auto h-5 w-5 text-gray-500`}- />- </CollapsibleTrigger><CollapsibleContent><div className="mt-6 text-sm">- <div className="mb-4 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"><Switchchecked={previewState.hideEventTypeDetails}onCheckedChange={(checked) => {@@ -1036,28 +1022,6 @@ const EmbedTypeCodeAndPreviewDialogContent = ({/><div className="text-sm">{t("hide_eventtype_details")}</div></div>- <Label className="">- <div className="mb-2">Theme</div>- <Select- className="w-full"- defaultValue={ThemeOptions[0]}- components={{- Control: ThemeSelectControl,- }}- onChange={(option) => {- if (!option) {- return;- }- setPreviewState((previewState) => {- return {- ...previewState,- theme: option.value,- };- });- }}- options={ThemeOptions}- />- </Label>{[{ name: "brandColor", title: "Brand Color" },// { name: "lightColor", title: "Light Color" },@@ -1066,8 +1030,8 @@ const EmbedTypeCodeAndPreviewDialogContent = ({// { name: "highlightColor", title: "Highlight Color" },// { name: "medianColor", title: "Median Color" },].map((palette) => (- <Label key={palette.name} className="pb-4">- <div className="mb-2 pt-2">{palette.title}</div>+ <Label key={palette.name} className="mb-6">+ <div className="mb-2">{palette.title}</div><div className="w-full"><ColorPickerpopoverAlign="start"@@ -1082,6 +1046,29 @@ const EmbedTypeCodeAndPreviewDialogContent = ({</div></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></CollapsibleContent></Collapsible>diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex 902037eee7e..07ca7483c57 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -1501,7 +1501,7 @@"date_overrides_update_btn": "Update Override","event_type_duplicate_copy_text": "{{slug}}-copy","set_as_default": "Set as default",- "hide_eventtype_details": "Hide EventType Details",+ "hide_eventtype_details": "Hide event type details","show_navigation": "Show navigation","hide_navigation": "Hide navigation","verification_code_sent": "Verification code sent",diff --git a/packages/ui/components/form/color-picker/colorpicker.tsx b/packages/ui/components/form/color-picker/colorpicker.tsxindex 651c986ee4b..166dd3dc349 100644--- a/packages/ui/components/form/color-picker/colorpicker.tsx+++ b/packages/ui/components/form/color-picker/colorpicker.tsx@@ -18,12 +18,12 @@ const ColorPicker = (props: ColorPickerProps) => {const [color, setColor] = useState(init);return (- <div className="mt-1 flex items-center justify-center">+ <div className="mt-1 flex h-[38px] items-center justify-center"><Popover.Root>- <div className="flex items-center rounded-l-md border border-r-0 border-gray-300 p-1.5">+ <div className="flex h-full w-10 items-center items-center justify-center rounded-l-md border border-r-0 border-gray-300"><Popover.Trigger asChild><button- className="h-6 w-6 rounded-sm border-2 border-gray-900"+ className="h-5 w-5 rounded-sm"aria-label="pick colors"style={{ backgroundColor: color }}/>@@ -44,7 +44,7 @@ const ColorPicker = (props: ColorPickerProps) => {</Popover.Root><HexColorInput- className="block w-full border border-gray-300 px-3 py-2 ltr:rounded-r-md rtl:rounded-l-md sm:text-sm"+ className="block h-full w-full border border-gray-300 px-3 py-2 ltr:rounded-r-md rtl:rounded-l-md sm:text-sm"color={color}onChange={(val) => {setColor(val);