-
Notifications
You must be signed in to change notification settings - Fork 0
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 #142 from goodeats/139-tooltips
tooltips
- Loading branch information
Showing
35 changed files
with
403 additions
and
310 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { createContainerComponent } from '../utils' | ||
|
||
const DialogContentGrid = createContainerComponent({ | ||
defaultTagName: 'div', | ||
defaultClassName: 'grid gap-4 py-4', | ||
displayName: 'DialogContentGrid', | ||
}) | ||
|
||
const DialogFormsContainer = createContainerComponent({ | ||
defaultTagName: 'div', | ||
defaultClassName: 'grid gap-2', | ||
displayName: 'DialogFormsContainer', | ||
}) | ||
|
||
export { DialogContentGrid, DialogFormsContainer } |
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 './dialog-form' |
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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './tooltip-for-content' | ||
export * from './tooltip-hydrated' |
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,27 @@ | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from '#app/components/ui/tooltip' | ||
|
||
// use only for content that is not interactive | ||
// like a button or link | ||
// for buttons or links, use TooltipHydrated | ||
|
||
export const TooltipForContent = ({ | ||
tooltipText, | ||
children, | ||
}: { | ||
tooltipText: string | ||
children: JSX.Element | ||
}) => { | ||
return ( | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger>{children}</TooltipTrigger> | ||
<TooltipContent>{tooltipText}</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
) | ||
} |
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,31 @@ | ||
import { | ||
Tooltip, | ||
TooltipContent, | ||
TooltipProvider, | ||
TooltipTrigger, | ||
} from '#app/components/ui/tooltip' | ||
|
||
// tooltip button, for example, needs to wait for hydration to avoid SSR issues | ||
// before hydration, render the button without the tooltip | ||
// after hydration, render the button with the tooltip | ||
|
||
export const TooltipHydrated = ({ | ||
tooltipText, | ||
isHydrated, | ||
children, | ||
}: { | ||
tooltipText: string | ||
isHydrated: boolean | ||
children: JSX.Element | ||
}) => { | ||
if (!isHydrated) return children | ||
|
||
return ( | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger asChild>{children}</TooltipTrigger> | ||
<TooltipContent>{tooltipText}</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
) | ||
} |
Oops, something went wrong.