-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: #235 v4 Deprecated existing Tooltip
- Loading branch information
Showing
10 changed files
with
62 additions
and
58 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
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...ents/tool-tip/__tests__/tool-tip.test.tsx → ...ated-tool-tip/__tests__/tool-tip.test.tsx
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
File renamed without changes.
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,35 @@ | ||
import { cx } from '@linaria/core' | ||
import React, { FC, HTMLAttributes, useState } from 'react' | ||
import { ElDeprecatedToolTipChild, elToolTipActive, ElDeprecatedToolTipContainer } from './__styles__' | ||
|
||
/** @deprecated */ | ||
export interface DeprecatedToolTipProps extends HTMLAttributes<HTMLDivElement> { | ||
defaultActive?: boolean | ||
tip?: string | ||
} | ||
|
||
/** @deprecated */ | ||
export interface DeprecatedToolTipChildProps extends HTMLAttributes<HTMLDivElement> { | ||
active?: boolean | ||
tip?: string | ||
} | ||
|
||
/** @deprecated */ | ||
export const DeprecatedToolTip: FC<DeprecatedToolTipProps> = ({ children, defaultActive = false, tip }) => { | ||
const [active, setActive] = useState<boolean>(defaultActive) | ||
|
||
return ( | ||
<ElDeprecatedToolTipContainer onMouseOver={() => setActive(true)} onMouseOut={() => setActive(false)}> | ||
{children} | ||
<ToolTipChild active={active}>{tip}</ToolTipChild> | ||
</ElDeprecatedToolTipContainer> | ||
) | ||
} | ||
|
||
export const ToolTipChild: FC<DeprecatedToolTipChildProps> = ({ children, active }) => { | ||
return ( | ||
<ElDeprecatedToolTipChild role="tooltip" className={cx(active && elToolTipActive)}> | ||
{children} | ||
</ElDeprecatedToolTipChild> | ||
) | ||
} |
1 change: 0 additions & 1 deletion
1
src/components/tool-tip/tooltip.mdx → ...omponents/deprecated-tool-tip/tooltip.mdx
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { DeprecatedToolTip } from './index' | ||
|
||
export default { | ||
title: 'DeprecatedToolTip', | ||
component: DeprecatedToolTip, | ||
} | ||
|
||
export const BasicUsage = { | ||
render: ({}) => <DeprecatedToolTip tip="Some Data">Hover here</DeprecatedToolTip>, | ||
} | ||
|
||
export const DefaultActive = { | ||
render: ({}) => ( | ||
<DeprecatedToolTip tip="Some Data" defaultActive> | ||
Hover here | ||
</DeprecatedToolTip> | ||
), | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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