-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat(design-system): Add tooltip component #25 * format * Apply suggestions from code review Co-authored-by: Vitor Capretz <[email protected]> * Fix import * Add tooltip to code block icons * formatting Co-authored-by: Vitor Capretz <[email protected]>
- Loading branch information
Showing
11 changed files
with
110 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
import '../styles/globals.css'; | ||
import type { AppProps } from 'next/app'; | ||
import { Tooltip } from 'design-system'; | ||
|
||
export default function MyApp({ Component, pageProps }: AppProps) { | ||
return <Component {...pageProps} />; | ||
return ( | ||
<Tooltip.Provider> | ||
<Component {...pageProps} /> | ||
</Tooltip.Provider> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './code'; | ||
export * from './icon-button'; | ||
export * from './icons'; | ||
export * from './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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TooltipArrow } from '@radix-ui/react-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Arrow, Content, Portal } from '@radix-ui/react-tooltip'; | ||
import * as React from 'react'; | ||
|
||
type ContentElement = React.ElementRef<typeof Content>; | ||
type ContentProps = React.ComponentPropsWithoutRef<typeof Content>; | ||
|
||
export interface TooltipProps extends ContentProps {} | ||
|
||
export const TooltipContent = React.forwardRef< | ||
ContentElement, | ||
Readonly<TooltipProps> | ||
>(({ className, sideOffset = 6, children, ...props }, forwardedRef) => ( | ||
<Portal> | ||
<Content | ||
{...props} | ||
ref={forwardedRef} | ||
className="bg-gray-2 border border-gray-7 z-20 px-2 py-1 rounded-md text-sm radix-side-top:animate-slide-down-fade radix-side-right:animate-slide-left-fade radix-side-bottom:animate-slide-up-fade radix-side-left:animate-slide-right-fade" | ||
sideOffset={sideOffset} | ||
> | ||
{children} | ||
<Arrow fill="#1c1c1f" /> | ||
</Content> | ||
</Portal> | ||
)); | ||
|
||
TooltipContent.displayName = 'TooltipContent'; |
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 @@ | ||
export { TooltipProvider } from '@radix-ui/react-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TooltipTrigger } from '@radix-ui/react-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Root } from '@radix-ui/react-tooltip'; | ||
import * as React from 'react'; | ||
import { TooltipArrow } from './tooltip-arrow'; | ||
import { TooltipContent } from './tooltip-content'; | ||
import { TooltipProvider } from './tooltip-provider'; | ||
import { TooltipTrigger } from './tooltip-trigger'; | ||
|
||
type RootProps = React.ComponentPropsWithoutRef<typeof Root>; | ||
|
||
export interface TooltipProps extends RootProps {} | ||
|
||
export const TooltipRoot: React.FC<Readonly<TooltipProps>> = ({ | ||
children, | ||
...props | ||
}) => <Root {...props}>{children}</Root>; | ||
|
||
export const Tooltip = Object.assign(TooltipRoot, { | ||
Arrow: TooltipArrow, | ||
Provider: TooltipProvider, | ||
Content: TooltipContent, | ||
Trigger: TooltipTrigger, | ||
}); |
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 |
---|---|---|
|
@@ -922,6 +922,25 @@ | |
"@babel/runtime" "^7.13.10" | ||
"@radix-ui/react-compose-refs" "1.0.0" | ||
|
||
"@radix-ui/react-tooltip@^1.0.0": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@radix-ui/react-tooltip/-/react-tooltip-1.0.0.tgz#f7fcecf2bac5c31cd14666b5acd056015fc21646" | ||
integrity sha512-RB06pov+O4Npy10ei1C6fsyB9QoOjz7Ubo8Sl3qdKtLgkL9iI96925DYtH0bxx6MH6YB2FuzLU6B75qn3AQQQw== | ||
dependencies: | ||
"@babel/runtime" "^7.13.10" | ||
"@radix-ui/primitive" "1.0.0" | ||
"@radix-ui/react-compose-refs" "1.0.0" | ||
"@radix-ui/react-context" "1.0.0" | ||
"@radix-ui/react-dismissable-layer" "1.0.0" | ||
"@radix-ui/react-id" "1.0.0" | ||
"@radix-ui/react-popper" "1.0.0" | ||
"@radix-ui/react-portal" "1.0.0" | ||
"@radix-ui/react-presence" "1.0.0" | ||
"@radix-ui/react-primitive" "1.0.0" | ||
"@radix-ui/react-slot" "1.0.0" | ||
"@radix-ui/react-use-controllable-state" "1.0.0" | ||
"@radix-ui/react-visually-hidden" "1.0.0" | ||
|
||
"@radix-ui/[email protected]": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.0.tgz#9e7b8b6b4946fe3cbe8f748c82a2cce54e7b6a90" | ||
|
@@ -968,6 +987,14 @@ | |
"@babel/runtime" "^7.13.10" | ||
"@radix-ui/react-use-layout-effect" "1.0.0" | ||
|
||
"@radix-ui/[email protected]": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.0.0.tgz#4d69d7e3b6d21ee4678ed6de5215dcd068394401" | ||
integrity sha512-MwAhMdX+n6S4InwRKSnpUsp+lLkYG6izQF56ul6guSX2mBBLOMV9Frx7xJlkEe2GjKLzbNuHhaCS6e5gopmZNA== | ||
dependencies: | ||
"@babel/runtime" "^7.13.10" | ||
"@radix-ui/react-primitive" "1.0.0" | ||
|
||
"@radix-ui/[email protected]": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@radix-ui/rect/-/rect-1.0.0.tgz#0dc8e6a829ea2828d53cbc94b81793ba6383bf3c" | ||
|
e62d6c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-email-preview – ./apps/preview
react-email-preview-git-main-klotty.vercel.app
react-email-preview-klotty.vercel.app
demo.react.email
react-email-preview.vercel.app
e62d6c0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
react-email – ./apps/website
react-email-seven.vercel.app
react-email-git-main-klotty.vercel.app
react.email
react-email-klotty.vercel.app