From 9c36083910dc9d4a448ab77b21a9242a664ec636 Mon Sep 17 00:00:00 2001 From: Vijayan Balasubramanian Date: Wed, 21 Dec 2022 13:25:04 -0800 Subject: [PATCH] Add tooltip for hover (#132) This will only show one of the pages. Signed-off-by: Vijayan Balasubramanian --- ...{tooltipClick.tsx => tooltipContainer.tsx} | 19 +++-- .../tooltip/tooltipHeaderContent.tsx | 5 +- .../components/tooltip/tooltipTable.tsx | 33 ++++++-- .../public/model/documentLayerFunctions.ts | 76 +++++++++++++++++-- 4 files changed, 104 insertions(+), 29 deletions(-) rename maps_dashboards/public/components/tooltip/{tooltipClick.tsx => tooltipContainer.tsx} (72%) diff --git a/maps_dashboards/public/components/tooltip/tooltipClick.tsx b/maps_dashboards/public/components/tooltip/tooltipContainer.tsx similarity index 72% rename from maps_dashboards/public/components/tooltip/tooltipClick.tsx rename to maps_dashboards/public/components/tooltip/tooltipContainer.tsx index 9dd2552a..5d883ed2 100644 --- a/maps_dashboards/public/components/tooltip/tooltipClick.tsx +++ b/maps_dashboards/public/components/tooltip/tooltipContainer.tsx @@ -5,17 +5,16 @@ import React from 'react'; -import { - EuiFlexItem, - EuiFlexGroup, - EuiPanel, - EuiText, - EuiHorizontalRule, -} from '@elastic/eui'; +import { EuiFlexItem, EuiFlexGroup, EuiPanel, EuiText, EuiHorizontalRule } from '@elastic/eui'; import { TooltipHeaderContent } from './tooltipHeaderContent'; import { TooltipTable } from './tooltipTable'; -export function TooltipClick(title: string, features: any[], onClose: Function) { +export function TooltipContainer( + title: string, + features: any[], + isClickEvent: boolean, + onClose: Function +) { const toTableRows = () => { const rows: any[] = []; for (const feature of features) { @@ -38,11 +37,11 @@ export function TooltipClick(title: string, features: any[], onClose: Function) - + - + diff --git a/maps_dashboards/public/components/tooltip/tooltipHeaderContent.tsx b/maps_dashboards/public/components/tooltip/tooltipHeaderContent.tsx index e9cbaf27..9d97993b 100644 --- a/maps_dashboards/public/components/tooltip/tooltipHeaderContent.tsx +++ b/maps_dashboards/public/components/tooltip/tooltipHeaderContent.tsx @@ -9,7 +9,7 @@ import React from 'react'; interface Props { title: string; - close: boolean; + isClickEvent: boolean; onClose: Function; } @@ -23,10 +23,9 @@ const TooltipHeaderContent = (props: Props) => { - {props.close && ( + {props.isClickEvent && (