From 47605d4118775ab916e0ceffa74f93409f90173f Mon Sep 17 00:00:00 2001 From: nischal Date: Thu, 23 Apr 2020 14:26:36 +0545 Subject: [PATCH] migrate tooltip to ts --- .../atoms/Tooltip/{Tooltip.js => Tooltip.ts} | 3 +- .../components/UIKit/atoms/Tooltip/index.tsx | 31 +++++++++++++++++++ console/src/declaration.d.ts | 1 + 3 files changed, 33 insertions(+), 2 deletions(-) rename console/src/components/UIKit/atoms/Tooltip/{Tooltip.js => Tooltip.ts} (97%) create mode 100644 console/src/components/UIKit/atoms/Tooltip/index.tsx diff --git a/console/src/components/UIKit/atoms/Tooltip/Tooltip.js b/console/src/components/UIKit/atoms/Tooltip/Tooltip.ts similarity index 97% rename from console/src/components/UIKit/atoms/Tooltip/Tooltip.js rename to console/src/components/UIKit/atoms/Tooltip/Tooltip.ts index 50cf27053bb38..5e7f0eb54b272 100644 --- a/console/src/components/UIKit/atoms/Tooltip/Tooltip.js +++ b/console/src/components/UIKit/atoms/Tooltip/Tooltip.ts @@ -4,6 +4,5 @@ import { space } from 'styled-system'; export const StyledTooltip = styled.span` display: inline-block; position: relative; - ${space} -`; +`; \ No newline at end of file diff --git a/console/src/components/UIKit/atoms/Tooltip/index.tsx b/console/src/components/UIKit/atoms/Tooltip/index.tsx new file mode 100644 index 0000000000000..c087e811f186d --- /dev/null +++ b/console/src/components/UIKit/atoms/Tooltip/index.tsx @@ -0,0 +1,31 @@ +import React from 'react'; +import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; +import Tooltip from 'react-bootstrap/lib/Tooltip'; +import { StyledTooltip } from './Tooltip'; + +export type ToolTypeGeneratorProps = { + message: string; +}; + +export const tooltipGenerator: React.FC = ({ + message, +}) => { + return {message}; +}; + +export type ToolTipProps = { + message: ToolTypeGeneratorProps; + placement: string; + children: any; +}; + +export const ToolTip: React.FC = props => { + const { message, placement, children } = props; + return ( + + + + ); +}; diff --git a/console/src/declaration.d.ts b/console/src/declaration.d.ts index f5dd5e6c5f293..73bd76c312738 100644 --- a/console/src/declaration.d.ts +++ b/console/src/declaration.d.ts @@ -8,3 +8,4 @@ declare namespace SvgPanZoom { } declare module 'react-bootstrap/lib/Tooltip'; +declare module 'react-bootstrap/lib/OverlayTrigger';