-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds tooltip component * updates tooltip component
- Loading branch information
1 parent
87e5912
commit 69864cb
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/components/primitive/tooltip/tooltip.component.props.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TooltipProps } from "react-tooltip"; | ||
import { IconProps } from "../icon-svg/icon-svg.component.props"; | ||
import { TextComponentProps } from "../text/text.component.props"; | ||
|
||
export interface TooltipComponentProps extends TooltipProps { | ||
/** | ||
* Icon (optional) | ||
*/ | ||
icon?: IconProps; | ||
|
||
/** | ||
* Text to be show | ||
*/ | ||
text: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import ReactTooltip from "react-tooltip"; | ||
import { IconSvg, Text } from ".."; | ||
import { TooltipComponentProps } from "./tooltip.component.props"; | ||
|
||
const Tooltip: React.FunctionComponent<TooltipComponentProps> = ( | ||
props: TooltipComponentProps | ||
) => { | ||
const { | ||
icon, | ||
text, | ||
...rest | ||
} = props; | ||
|
||
return ( | ||
<> | ||
<Text data-tip={text}> | ||
{icon ? <IconSvg {...icon} /> : <IconSvg color="primary" name="info" />} | ||
</Text> | ||
<ReactTooltip {...rest}/> | ||
</> | ||
); | ||
}; | ||
|
||
export default Tooltip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters