-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #32731 from software-mansion-labs/ts/UserDetailsTo…
…oltip [TS migration] Migrate 'UserDetailsTooltip' component to TypeScript
- Loading branch information
Showing
14 changed files
with
128 additions
and
145 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
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
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
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
19 changes: 0 additions & 19 deletions
19
src/components/UserDetailsTooltip/BaseUserDetailsTooltip.js
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.native.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import UserDetailsTooltipProps from '@components/UserDetailsTooltip/types'; | ||
|
||
function BaseUserDetailsTooltip({children}: UserDetailsTooltipProps) { | ||
return children; | ||
} | ||
|
||
BaseUserDetailsTooltip.displayName = 'BaseUserDetailsTooltip'; | ||
|
||
export default BaseUserDetailsTooltip; |
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 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import BaseUserDetailsTooltip from './BaseUserDetailsTooltip/index.native'; | ||
import UserDetailsTooltipProps from './types'; | ||
|
||
function UserDetailsTooltip({shouldRender = true, children, ...props}: UserDetailsTooltipProps) { | ||
if (!shouldRender) { | ||
return children; | ||
} | ||
|
||
return ( | ||
<BaseUserDetailsTooltip | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
> | ||
{children} | ||
</BaseUserDetailsTooltip> | ||
); | ||
} | ||
|
||
UserDetailsTooltip.displayName = 'UserDetailsTooltip'; | ||
|
||
export default UserDetailsTooltip; |
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,56 @@ | ||
import {AvatarSource} from '@libs/UserUtils'; | ||
import {AvatarType} from '@src/types/onyx/OnyxCommon'; | ||
import ChildrenProps from '@src/types/utils/ChildrenProps'; | ||
|
||
type FallbackUserDetails = { | ||
/** The name to display in bold */ | ||
displayName?: string; | ||
|
||
/** The login for the tooltip fallback */ | ||
login?: string; | ||
|
||
/** The avatar for the tooltip fallback */ | ||
avatar?: AvatarSource; | ||
|
||
/** Denotes whether it is an avatar or a workspace avatar */ | ||
type?: AvatarType; | ||
}; | ||
|
||
type Icon = { | ||
/** Source for the avatar. Can be a URL or an icon. */ | ||
source?: AvatarSource; | ||
|
||
/** A fallback avatar icon to display when there is an error on loading avatar from remote URL. | ||
* If the avatar is type === workspace, this fallback icon will be ignored and decided based on the name prop. | ||
*/ | ||
fallbackIcon?: AvatarSource; | ||
|
||
/** Denotes whether it is an avatar or a workspace avatar */ | ||
type?: AvatarType; | ||
|
||
/** Owner of the avatar. If user, displayName. If workspace, policy name */ | ||
name?: string; | ||
}; | ||
|
||
type UserDetailsTooltipProps = ChildrenProps & { | ||
/** User's Account ID */ | ||
accountID: number; | ||
|
||
/** Fallback User Details object used if no accountID */ | ||
fallbackUserDetails?: FallbackUserDetails; | ||
|
||
/** Optionally, pass in the icon instead of calculating it. If defined, will take precedence. */ | ||
icon?: Icon; | ||
|
||
/** The accountID of the copilot who took this action on behalf of the user */ | ||
delegateAccountID?: number; | ||
|
||
/** Any additional amount to manually adjust the horizontal position of the tooltip. | ||
A positive value shifts the tooltip to the right, and a negative value shifts it to the left. */ | ||
shiftHorizontal?: number | (() => number); | ||
|
||
/** Whether the actual UserDetailsTooltip should be rendered. If false, it's just going to return the children */ | ||
shouldRender?: boolean; | ||
}; | ||
|
||
export default UserDetailsTooltipProps; |
Oops, something went wrong.