From 422df63ff3104dcf696c7326539c465e9ea2f12f Mon Sep 17 00:00:00 2001 From: Samuel Valdes Gutierrez Date: Sun, 5 Nov 2023 20:55:58 +0000 Subject: [PATCH] refactoring changing 'let' variables with 'const' Signed-off-by: Samuel Valdes Gutierrez --- src/components/breadcrumbs/breadcrumbs.tsx | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/components/breadcrumbs/breadcrumbs.tsx b/src/components/breadcrumbs/breadcrumbs.tsx index 94b82627ef..9253b331b1 100644 --- a/src/components/breadcrumbs/breadcrumbs.tsx +++ b/src/components/breadcrumbs/breadcrumbs.tsx @@ -241,10 +241,8 @@ export const OuiBreadcrumbs: FunctionComponent = ({ 'ouiBreadcrumb--truncate': truncate, }); - let link; - - if (!href && !onClick) { - link = ( + const link = + !href && !onClick ? ( {(ref, innerText) => ( = ({ )} - ); - } else { - link = ( + ) : ( {(ref, innerText) => ( = ({ )} ); - } - - let wrapper =
{link}
; - if (isFirstBreadcrumb) { - const breadcrumbWallClasses = classNames('ouiBreadcrumbWall', { - 'ouiBreadcrumbWall--single': isLastBreadcrumb, - }); - - wrapper =
{wrapper}
; - } + const breadcrumbWallClasses = isFirstBreadcrumb + ? classNames('ouiBreadcrumbWall', { + 'ouiBreadcrumbWall--single': isLastBreadcrumb, + }) + : breadcrumbWrapperClasses; + + const wrapper = ( +
+ {isFirstBreadcrumb ? ( +
{link}
+ ) : ( + link + )} +
+ ); return {wrapper}; });