From 273d98332ea1d1693de7b77a0a4d65d04411467f Mon Sep 17 00:00:00 2001 From: Rahul Tripathi Date: Thu, 22 Jun 2023 17:54:04 +0530 Subject: [PATCH] Clean up HighlightBar.tsx and remove dup code --- .../web/components/patterns/HighlightBar.tsx | 259 +++++++----------- 1 file changed, 98 insertions(+), 161 deletions(-) diff --git a/packages/web/components/patterns/HighlightBar.tsx b/packages/web/components/patterns/HighlightBar.tsx index b1ba39049..ad1aff3f3 100644 --- a/packages/web/components/patterns/HighlightBar.tsx +++ b/packages/web/components/patterns/HighlightBar.tsx @@ -32,50 +32,75 @@ type HighlightBarProps = { } export function HighlightBar(props: HighlightBarProps): JSX.Element { - if (props.displayAtBottom) { - return ( - - - - ) - } else { - return ( - - - - ) - } + return ( + + + + ) +} + +type BarButtonProps = { + title: string + onClick: VoidFunction + iconElement: JSX.Element + text: string +} + +function BarButton({ text, title, iconElement, onClick }: BarButtonProps) { + return ( + + ) } function BarContent(props: HighlightBarProps): JSX.Element { @@ -97,139 +122,51 @@ function BarContent(props: HighlightBarProps): JSX.Element { }} > {props.isNewHighlight ? ( - + /> ) : ( <> - + } + onClick={() => props.handleButtonClick('delete')} + /> - - + } + onClick={() => props.handleButtonClick('setHighlightLabels')} + /> )} - + } + onClick={() => props.handleButtonClick('comment')} + /> - - {/* - */} + } + onClick={() => props.handleButtonClick('copy')} + /> ) }