From 78f25aedf3db870f808ef0b44c5dfd4b053a623c Mon Sep 17 00:00:00 2001 From: Afzal Date: Mon, 23 Oct 2023 15:44:07 +0530 Subject: [PATCH] chore: handle deprecated action callback property correctly --- src/@next/Bar/Bar.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/@next/Bar/Bar.tsx b/src/@next/Bar/Bar.tsx index e252760e4..f6d9dcf10 100644 --- a/src/@next/Bar/Bar.tsx +++ b/src/@next/Bar/Bar.tsx @@ -64,6 +64,14 @@ export const Bar = React.forwardRef(function Bar( const buttonSize: 'default' | 'large' = width <= breakpointWidth ? 'default' : 'large'; + function makeButtonProps(buttonAction: ComponentAction) { + const { onClick, action, ...otherProps } = buttonAction; + return { + onClick: onClick || action, + ...otherProps, + }; + } + return ( @@ -79,17 +87,20 @@ export const Bar = React.forwardRef(function Bar( ) : ( {tertiaryAction && ( - )} {secondaryAction && ( - )} {primaryAction && ( - + {primaryAction.label} )}