forked from rad-ui/ui
-
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.
Fix rad-ui#577: [New Feature] Added Multiple direction support for To…
…oltip rad-ui#577
- Loading branch information
1 parent
08cc93b
commit 507cd68
Showing
3 changed files
with
40 additions
and
7 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
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 |
---|---|---|
@@ -1,19 +1,40 @@ | ||
import React from 'react'; | ||
|
||
import Popper from '~/components/tools/Popper/Popper'; | ||
|
||
const COMPONENT_NAME = 'Tooltip'; | ||
|
||
type TooltipProps = { | ||
children: React.ReactNode; | ||
label: string; | ||
placement?: | ||
| 'top' | ||
| 'bottom' | ||
| 'left' | ||
| 'right' | ||
| 'top-start' | ||
| 'top-end' | ||
| 'bottom-start' | ||
| 'bottom-end' | ||
| 'left-start' | ||
| 'left-end' | ||
| 'right-start' | ||
| 'right-end'; | ||
[key: string]: any; | ||
}; | ||
|
||
const Tooltip = ({ children, label, ...props }:TooltipProps) => { | ||
return <div> | ||
<Popper popperName={COMPONENT_NAME} pop={'hello'} {...props}>{children}</Popper> | ||
</div>; | ||
const Tooltip = ({ children, label="hello", placement = 'top', ...props }: TooltipProps) => { | ||
return ( | ||
<div> | ||
<Popper | ||
popperName={COMPONENT_NAME} | ||
pop={label} | ||
placement={placement} | ||
{...props} | ||
> | ||
{children} | ||
</Popper> | ||
</div> | ||
); | ||
}; | ||
|
||
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