-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1922 from fhlavac/replace-tooltip
- Loading branch information
Showing
10 changed files
with
13 additions
and
255 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from '@patternfly/react-component-groups/dist/dynamic/Ansible'; | ||
export { default } from './Ansible'; | ||
export { default as Ansible } from './Ansible'; |
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,2 +1,3 @@ | ||
export * from '@patternfly/react-component-groups/dist/dynamic/ErrorBoundary'; | ||
export { default } from './ErrorBoundary'; | ||
export { default as ErrorBoundary } from './ErrorBoundary'; |
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,3 +1,4 @@ | ||
export * from '@patternfly/react-component-groups/dist/dynamic/ErrorState'; | ||
export { default } from './ErrorState'; | ||
export { default as ErrorState } from './ErrorState'; | ||
export { default as DefaultErrorMessage } from './DefaultErrorMessage'; |
46 changes: 0 additions & 46 deletions
46
packages/components/src/LongTextTooltip/LongTextTooltip.test.js
This file was deleted.
Oops, something went wrong.
31 changes: 6 additions & 25 deletions
31
packages/components/src/LongTextTooltip/LongTextTooltip.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,10 @@ | ||
import { Tooltip, TooltipPosition, TooltipProps } from '@patternfly/react-core'; | ||
import React from 'react'; | ||
import LongTextTooltipPF, { LongTextTooltipProps } from '@patternfly/react-component-groups/dist/dynamic/LongTextTooltip'; | ||
|
||
export interface LongTextTooltipProps extends Omit<TooltipProps, 'content'> { | ||
content?: string; | ||
maxLength?: number; | ||
tooltipPosition?: TooltipPosition; | ||
tooltipMaxWidth?: string; | ||
} | ||
|
||
const LongTextTooltip: React.FC<LongTextTooltipProps> = ({ | ||
content = '', | ||
maxLength = Infinity, | ||
tooltipMaxWidth = '50vw', | ||
tooltipPosition = TooltipPosition.top, | ||
...rest | ||
}) => { | ||
const truncate = (str: string, max: number) => (str.length > max ? str.substr(0, max - 1) + '…' : str); | ||
|
||
return content.length > maxLength ? ( | ||
<Tooltip maxWidth={tooltipMaxWidth} position={tooltipPosition} content={<div>{content}</div>} {...rest}> | ||
<div>{truncate(content, maxLength)}</div> | ||
</Tooltip> | ||
) : ( | ||
<span>{content}</span> | ||
); | ||
}; | ||
/** | ||
* @deprecated Do not use deprecated LongTextTooltip import, the component has been moved to @patternfly/react-component-groups | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const LongTextTooltip: React.FunctionComponent<LongTextTooltipProps> = (props) => <LongTextTooltipPF {...props} />; | ||
|
||
export default LongTextTooltip; |
182 changes: 0 additions & 182 deletions
182
packages/components/src/LongTextTooltip/__snapshots__/LongTextTooltip.test.js.snap
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from '@patternfly/react-component-groups/dist/dynamic/LongTextTooltip'; | ||
export { default } from './LongTextTooltip'; | ||
export { default as LongTextTooltip } from './LongTextTooltip'; | ||
export * from './LongTextTooltip'; |
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,2 +1,3 @@ | ||
export * from '@patternfly/react-component-groups/dist/dynamic/NotAuthorized'; | ||
export { default } from './NotAuthorized'; | ||
export { default as NotAuthorized } from './NotAuthorized'; |