From 1626d7c248072f3ffd9bd46b15abceb9a23a6be0 Mon Sep 17 00:00:00 2001 From: serh11p Date: Wed, 7 Apr 2021 17:51:57 +0300 Subject: [PATCH] Fix UI issues with analytics --- src/app/atoms/Button.tsx | 39 ++++++++++++------- .../PageLayout/Header/AccountDropdown.tsx | 10 +++-- src/app/templates/AdditionalFeeInput.tsx | 2 +- src/lib/analytics/use-form-analytics.hook.ts | 28 ++++++++----- 4 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/app/atoms/Button.tsx b/src/app/atoms/Button.tsx index 76007efd9..b06d02749 100644 --- a/src/app/atoms/Button.tsx +++ b/src/app/atoms/Button.tsx @@ -1,23 +1,34 @@ import * as React from "react"; -import { AnalyticsEventCategory, TestIDProps, useAnalytics } from "lib/analytics"; +import { + AnalyticsEventCategory, + TestIDProps, + useAnalytics, +} from "lib/analytics"; -interface Props extends React.DetailedHTMLProps, HTMLButtonElement>, TestIDProps { -} +interface Props + extends React.DetailedHTMLProps< + React.ButtonHTMLAttributes, + HTMLButtonElement + >, + TestIDProps {} -export const Button = React.forwardRef(({ - testID, - testIDProperties, - onClick, - ...props - }, ref) => { +export const Button = React.forwardRef( + ({ testID, testIDProperties, onClick, ...props }, ref) => { const { trackEvent } = useAnalytics(); - const handleClick = (e: React.MouseEvent) => { - testID !== undefined && trackEvent(testID, AnalyticsEventCategory.ButtonPress, testIDProperties); + const handleClick = ( + e: React.MouseEvent + ) => { + testID !== undefined && + trackEvent( + testID, + AnalyticsEventCategory.ButtonPress, + testIDProperties + ); - onClick !== undefined && onClick(e); - } - return