- Notifications
You must be signed in to change notification settings - Fork1k
refactor: replace MUI Tooltip with MiniTooltip#20027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
aqandrew wants to merge10 commits intomainChoose a base branch fromaqandrew/replace-mui-tooltip
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+241 −193
Draft
Changes fromall commits
Commits
Show all changes
10 commits Select commitHold shift + click to select a range
3e71889
refactor: replace MUI Tooltip with MiniTooltip
aqandrew262df48
refactor: replace MUI Tooltip with MiniTooltip in Badges
aqandrew8cbcb7b
chore: lint:fix
aqandrew062dc85
fix: add aria-label to MiniTooltip trigger
aqandrew9438da7
refactor: replace MUI Tooltip in components which pass JSX to title
aqandrewf2e21a8
style: format
aqandrewe0e2bcd
style: sort imports
aqandrewfd62277
style: check:fix
aqandrew2991d90
fix: use open prop as default isOpen
aqandrewd843fa9
Merge branch 'main' into aqandrew/replace-mui-tooltip
aqandrewFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,53 @@ | ||
import { | ||
Tooltip, | ||
TooltipArrow, | ||
TooltipContent, | ||
type TooltipContentProps, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from "components/Tooltip/Tooltip"; | ||
import { type FC, type ReactNode, useState } from "react"; | ||
import { cn } from "utils/cn"; | ||
type MiniTooltipProps = Omit<TooltipContentProps, "title"> & { | ||
title: ReactNode; | ||
arrow?: boolean; | ||
open?: boolean; | ||
}; | ||
const MiniTooltip: FC<MiniTooltipProps> = ({ | ||
title, | ||
children, | ||
arrow, | ||
open = false, | ||
...contentProps | ||
}) => { | ||
const [isOpen, setIsOpen] = useState(open); | ||
return ( | ||
<TooltipProvider> | ||
<Tooltip delayDuration={0} open={isOpen} onOpenChange={setIsOpen}> | ||
<TooltipTrigger | ||
asChild | ||
aria-label={typeof title === "string" ? title : undefined} | ||
> | ||
{children} | ||
</TooltipTrigger> | ||
<TooltipContent | ||
collisionPadding={16} | ||
side="bottom" | ||
{...contentProps} | ||
className={cn( | ||
"max-w-[300px] bg-surface-secondary border-surface-quaternary text-content-primary text-xs", | ||
contentProps.className, | ||
)} | ||
> | ||
{title} | ||
{arrow && <TooltipArrow className="fill-surface-quaternary" />} | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
); | ||
}; | ||
export default MiniTooltip; |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.