Skip to content

Commit

Permalink
✨ feat(tooltip): add TooltipWithToggleDemo component to registry (#5)
Browse files Browse the repository at this point in the history
📚 docs(tooltip): add documentation for TooltipWithToggleDemo component
  • Loading branch information
nyxb authored Jul 8, 2024
1 parent cf760a5 commit 8e416bb
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
22 changes: 22 additions & 0 deletions apps/web/__registry__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,17 @@ export const Index: Record<string, any> = {
subcategory: 'undefined',
chunks: [],
},
'tooltip-with-toggle-demo': {
name: 'tooltip-with-toggle-demo',
type: 'components:example',
registryDependencies: ['tooltip'],
component: React.lazy(() => import('~/registry/default/example/tooltip-with-toggle-demo')),
source: '',
files: ['registry/default/example/tooltip-with-toggle-demo.tsx'],
category: 'undefined',
subcategory: 'undefined',
chunks: [],
},
'typography-blockquote': {
name: 'typography-blockquote',
type: 'components:example',
Expand Down Expand Up @@ -8149,6 +8160,17 @@ export const Index: Record<string, any> = {
subcategory: 'undefined',
chunks: [],
},
'tooltip-with-toggle-demo': {
name: 'tooltip-with-toggle-demo',
type: 'components:example',
registryDependencies: ['tooltip'],
component: React.lazy(() => import('~/registry/miami/example/tooltip-with-toggle-demo')),
source: '',
files: ['registry/miami/example/tooltip-with-toggle-demo.tsx'],
category: 'undefined',
subcategory: 'undefined',
chunks: [],
},
'typography-blockquote': {
name: 'typography-blockquote',
type: 'components:example',
Expand Down
4 changes: 4 additions & 0 deletions apps/web/content/docs/components/tooltip.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ styleSwitch={true}
button="copy"
dots={false}
/>

### Tooltip with Toggle

<ComponentPreview name="tooltip-with-toggle-demo" description="A tooltip with Toggle component." styleSwitch={true} button="copy" dots={false} />
26 changes: 26 additions & 0 deletions apps/web/registry/default/example/tooltip-with-toggle-demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Heart } from 'lucide-react'

import { Toggle } from '~/registry/default/ui/toggle'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '~/registry/default/ui/tooltip'

export default function TooltipWithToggleDemo() {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Toggle variant="outline" aria-label="Toggle love">
<Heart className="h-4 w-4" />
</Toggle>
</TooltipTrigger>
<TooltipContent>
<p>Heart</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
)
}
6 changes: 6 additions & 0 deletions apps/web/registry/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,12 @@ export const examples: Registry = [
registryDependencies: ['tooltip'],
files: ['example/tooltip-secondary.tsx'],
},
{
name: 'tooltip-with-toggle-demo',
type: 'components:example',
registryDependencies: ['tooltip'],
files: ['example/tooltip-with-toggle-demo.tsx'],
},
{
name: 'typography-blockquote',
type: 'components:example',
Expand Down
24 changes: 24 additions & 0 deletions apps/web/registry/miami/example/tooltip-with-toggle-demo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Heart } from 'lucide-react'

import { Toggle } from '~/registry/miami/ui/toggle'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '~/registry/miami/ui/tooltip'

export default function TooltipWithToggleDemo() {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<Toggle variant="outline" aria-label="Toggle Heart">
<Heart className="h-4 w-4" />
</Toggle>
</TooltipTrigger>
<TooltipContent><p>Heart</p></TooltipContent>
</Tooltip>
</TooltipProvider>
)
}

1 comment on commit 8e416bb

@vercel
Copy link

@vercel vercel bot commented on 8e416bb Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.