From 71ee9c72fe93480a1d7d20ad3062d0f0b689e7e3 Mon Sep 17 00:00:00 2001 From: Peer Richelsen Date: Mon, 2 Jan 2023 09:28:12 +0100 Subject: [PATCH] introduced size="fab" prop to Button, added to CTA buttons (#6176) * introduced size="fab" prop to Button, added to CTA buttons * increased size of FAB * nit --- apps/web/pages/teams/index.tsx | 7 +- apps/web/styles/globals.css | 18 ---- .../pages/forms/[...appPages].tsx | 7 +- .../features/ee/workflows/pages/index.tsx | 1 + .../components/CreateEventTypeButton.tsx | 4 +- .../components/NewScheduleButton.tsx | 2 +- packages/ui/components/button/Button.tsx | 37 +++++++- packages/ui/v2/core/Dropdown.tsx | 7 +- packages/ui/v2/core/Shell.tsx | 93 ++++++++++--------- 9 files changed, 100 insertions(+), 76 deletions(-) diff --git a/apps/web/pages/teams/index.tsx b/apps/web/pages/teams/index.tsx index bd93230b7c..7785e8b873 100644 --- a/apps/web/pages/teams/index.tsx +++ b/apps/web/pages/teams/index.tsx @@ -14,8 +14,11 @@ function Teams() { heading={t("teams")} subtitle={t("create_manage_teams_collaborative")} CTA={ - }> diff --git a/apps/web/styles/globals.css b/apps/web/styles/globals.css index 39d3615204..726c8a8b92 100644 --- a/apps/web/styles/globals.css +++ b/apps/web/styles/globals.css @@ -215,17 +215,6 @@ button[role="switch"][data-state="checked"] { background: black; } -/* add padding bottom to bottom nav on standalone mode */ -@media all and (display-mode: standalone) { - .bottom-nav { - padding-bottom: 24px; - } - - .cta { - bottom: 100px; - } -} - /* hide chat bubble on mobile */ @media only screen and (max-width: 768px) { /* Intercom FAB*/ @@ -247,13 +236,6 @@ button[role="switch"][data-state="checked"] { } } -/* add padding bottom to bottom nav on standalone mode */ -@media all and (display-mode: standalone) { - .bottom-nav { - padding-bottom: 24px; - } -} - .react-multi-email > [type="text"] { @apply dark:placeholder:text-darkgray-600 focus:border-brand dark:border-darkgray-300 dark:text-darkgray-900 block w-full rounded-md border-gray-300 text-sm focus:ring-black disabled:bg-gray-200 disabled:hover:cursor-not-allowed dark:bg-transparent dark:selection:bg-green-500 disabled:dark:text-gray-500 dark:text-white; } diff --git a/packages/app-store/ee/routing-forms/pages/forms/[...appPages].tsx b/packages/app-store/ee/routing-forms/pages/forms/[...appPages].tsx index 2f7c785f8d..3f26ac4a5a 100644 --- a/packages/app-store/ee/routing-forms/pages/forms/[...appPages].tsx +++ b/packages/app-store/ee/routing-forms/pages/forms/[...appPages].tsx @@ -36,7 +36,12 @@ export default function RoutingForms({ function NewFormButton() { return ( - + {t("new")} ); diff --git a/packages/features/ee/workflows/pages/index.tsx b/packages/features/ee/workflows/pages/index.tsx index 113548233c..8f4b596d97 100644 --- a/packages/features/ee/workflows/pages/index.tsx +++ b/packages/features/ee/workflows/pages/index.tsx @@ -43,6 +43,7 @@ function WorkflowsPage() { CTA={ session.data?.hasValidLicense && data?.workflows && data?.workflows.length > 0 ? ( @@ -165,11 +166,12 @@ export default function CreateEventTypeButton(props: CreateEventTypeBtnProps) { - +
{t("new_event_subtitle")}
diff --git a/packages/features/schedules/components/NewScheduleButton.tsx b/packages/features/schedules/components/NewScheduleButton.tsx index 31113972b4..65b7d5018d 100644 --- a/packages/features/schedules/components/NewScheduleButton.tsx +++ b/packages/features/schedules/components/NewScheduleButton.tsx @@ -58,7 +58,7 @@ export function NewScheduleButton({ name = "new-schedule" }: { name?: string }) return ( - diff --git a/packages/ui/components/button/Button.tsx b/packages/ui/components/button/Button.tsx index c61aba5599..525acbd848 100644 --- a/packages/ui/components/button/Button.tsx +++ b/packages/ui/components/button/Button.tsx @@ -6,6 +6,7 @@ import classNames from "@calcom/lib/classNames"; import { applyStyleToMultipleVariants } from "@calcom/lib/cva"; import { SVGComponent } from "@calcom/types/SVGComponent"; import { Tooltip } from "@calcom/ui"; +import { Icon } from "@calcom/ui"; type InferredVariantProps = VariantProps; @@ -45,6 +46,9 @@ const buttonClasses = cva( base: "h-9 px-4 py-2.5 ", lg: "h-[36px] px-4 py-2.5 ", icon: "flex justify-center min-h-[36px] min-w-[36px] ", + // fab = floating action button, used for the main action in a page. + // it uses the same primary classNames for desktop size + fab: "h-14 w-14 sm:h-9 sm:w-auto rounded-full justify-center sm:rounded-md sm:px-4 sm:py-2.5 radix-state-open:rotate-45 sm:radix-state-open:rotate-0 transition-transform radix-state-open:shadown-none radix-state-open:ring-0 !shadow-none", }, loading: { true: "cursor-wait", @@ -176,11 +180,23 @@ export const Button = forwardRef {StartIcon && ( - + <> + {size === "fab" ? ( + <> + + + + ) : ( + + )} + )} - {props.children} + {size === "fab" ? {props.children} : props.children} {loading && (
)} - {EndIcon && } + {EndIcon && ( + <> + {size === "fab" ? ( + <> + + + + ) : ( + + )} + + )} ); diff --git a/packages/ui/v2/core/Dropdown.tsx b/packages/ui/v2/core/Dropdown.tsx index 33f618e1bf..b09a16927c 100644 --- a/packages/ui/v2/core/Dropdown.tsx +++ b/packages/ui/v2/core/Dropdown.tsx @@ -15,7 +15,7 @@ export const DropdownMenuTrigger = forwardRef; export const DropdownMenuContent = forwardRef( - ({ children, align = "end", ...props }, forwardedRef) => { + ({ children, sideOffset = 2, align = "end", ...props }, forwardedRef) => { return ( {children} diff --git a/packages/ui/v2/core/Shell.tsx b/packages/ui/v2/core/Shell.tsx index 549ac0fedf..7812f5dcba 100644 --- a/packages/ui/v2/core/Shell.tsx +++ b/packages/ui/v2/core/Shell.tsx @@ -254,50 +254,53 @@ function UserDropdown({ small }: { small?: boolean }) { } return ( - setMenuOpen((menuOpen) => !menuOpen)}> - - + {!small && ( + + + + {user.name || "Nameless User"} + + + {user.username + ? process.env.NEXT_PUBLIC_WEBSITE_URL === "https://cal.com" + ? `cal.com/${user.username}` + : `/${user.username}` + : "No public page"} + + + + )} + + + + { @@ -782,7 +785,7 @@ function SideBar() { {isCalcom && } -
+
@@ -838,7 +841,7 @@ export function ShellMain(props: LayoutProps) { {props.CTA && (
{props.CTA}