From 0d7074a172d68184445c5fc9ed8d391d396c2c31 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 26 Feb 2024 15:17:29 -0500 Subject: [PATCH] Finalize Button migration (#10367) * Don't export the legacy getButtonClasses function * Deleted legacy Button component; add ref forwarding support to new button --- packages/replay-next/components/Button.tsx | 30 ++-- pages/browser/choose-role.tsx | 16 +-- pages/browser/welcome.tsx | 13 +- .../components/Timeline/FocusModePopout.tsx | 11 +- src/ui/components/shared/Button.tsx | 132 ------------------ .../shared/Confirm/ConfirmDialog.tsx | 14 +- .../components/shared/LaunchBrowserModal.tsx | 2 - .../AddPaymentMethod.tsx | 15 +- .../shared/WorkspaceSettingsModal/Details.tsx | 12 +- .../WorkspaceSettingsModal/PricingPage.tsx | 12 +- 10 files changed, 47 insertions(+), 210 deletions(-) delete mode 100644 src/ui/components/shared/Button.tsx diff --git a/packages/replay-next/components/Button.tsx b/packages/replay-next/components/Button.tsx index 0ed91b45438..75548e115ea 100644 --- a/packages/replay-next/components/Button.tsx +++ b/packages/replay-next/components/Button.tsx @@ -1,25 +1,29 @@ -import { ButtonHTMLAttributes } from "react"; +import { ButtonHTMLAttributes, ForwardedRef, forwardRef } from "react"; import styles from "./Button.module.css"; -export function Button({ - className = "", - color = "primary", - size = "normal", - variant = "solid", - ...rest -}: ButtonHTMLAttributes & { - color?: "primary" | "secondary"; - size?: "normal" | "large" | "small"; - variant?: "outline" | "solid"; -}) { +export const Button = forwardRef(function Button( + { + className = "", + color = "primary", + size = "normal", + variant = "solid", + ...rest + }: ButtonHTMLAttributes & { + color?: "primary" | "secondary"; + size?: "normal" | "large" | "small"; + variant?: "outline" | "solid"; + }, + ref: ForwardedRef +) { return ( - + +