Skip to content

Commit

Permalink
Merge branch 'main' into aakash19here/tooltip-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash19here committed Jun 29, 2024
2 parents b9af8c7 + 06cc0cd commit d6427c9
Show file tree
Hide file tree
Showing 49 changed files with 3,183 additions and 3,529 deletions.
71 changes: 33 additions & 38 deletions apps/www/app/(app)/examples/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,38 @@ interface ExamplesLayoutProps {

export default function ExamplesLayout({ children }: ExamplesLayoutProps) {
return (
<>
<div className="container relative">
<PageHeader>
<Announcement />
<PageHeaderHeading className="hidden md:block">
Check out some examples
</PageHeaderHeading>
<PageHeaderHeading className="md:hidden">Examples</PageHeaderHeading>
<PageHeaderDescription>
Dashboard, cards, authentication. Some examples built using the
components. Use this as a guide to build your own.
</PageHeaderDescription>
<PageActions>
<Link
href="/docs"
className={cn(buttonVariants(), "rounded-[6px]")}
>
Get Started
</Link>
<Link
href="/components"
className={cn(
buttonVariants({ variant: "outline" }),
"rounded-[6px]"
)}
>
Components
</Link>
</PageActions>
</PageHeader>
<section>
<ExamplesNav />
<div className="overflow-hidden rounded-[0.5rem] border bg-background shadow-md md:shadow-xl">
{children}
</div>
</section>
</div>
</>
<div className="container relative">
<PageHeader>
<Announcement />
<PageHeaderHeading className="hidden md:block">
Check out some examples
</PageHeaderHeading>
<PageHeaderHeading className="md:hidden">Examples</PageHeaderHeading>
<PageHeaderDescription>
Dashboard, cards, authentication. Some examples built using the
components. Use this as a guide to build your own.
</PageHeaderDescription>
<PageActions>
<Link href="/docs" className={cn(buttonVariants(), "rounded-[6px]")}>
Get Started
</Link>
<Link
href="/components"
className={cn(
buttonVariants({ variant: "outline" }),
"rounded-[6px]"
)}
>
Components
</Link>
</PageActions>
</PageHeader>
<section>
<ExamplesNav />
<div className="overflow-hidden rounded-[0.5rem] border bg-background shadow">
{children}
</div>
</section>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function ModelItem({ model, isSelected, onSelect, onPeek }: ModelItemProps) {
key={model.id}
onSelect={onSelect}
ref={ref}
className="aria-selected:bg-primary aria-selected:text-primary-foreground"
className="data-[selected=true]:bg-primary data-[selected=true]:text-primary-foreground"
>
{model.name}
<CheckIcon
Expand Down
2 changes: 1 addition & 1 deletion apps/www/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function IndexPage() {
/>
</section>
<section className="hidden md:block">
<div className="overflow-hidden rounded-lg border bg-background shadow-lg">
<div className="overflow-hidden rounded-lg border bg-background shadow">
<MailPage />
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions apps/www/components/block-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export function BlockToolbar({
{block.hasLiftMode && (
<>
<div className="flex h-7 items-center justify-between gap-2">
<Label htmlFor="lift-mode" className="text-xs">
<Label htmlFor={`lift-mode-${block.name}`} className="text-xs">
Lift Mode
</Label>
<Switch
id="lift-mode"
id={`lift-mode-${block.name}`}
checked={isLiftMode}
onCheckedChange={(value) => {
resizablePanelRef.current?.resize(100)
Expand Down
26 changes: 19 additions & 7 deletions apps/www/components/component-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CopyButton, CopyWithClassNames } from "@/components/copy-button"
import { Icons } from "@/components/icons"
import { StyleSwitcher } from "@/components/style-switcher"
import { ThemeWrapper } from "@/components/theme-wrapper"
import { V0Button } from "@/components/v0-button"
import {
Tabs,
TabsContent,
Expand All @@ -22,6 +23,7 @@ interface ComponentPreviewProps extends React.HTMLAttributes<HTMLDivElement> {
extractClassname?: boolean
extractedClassNames?: string
align?: "center" | "start" | "end"
description?: string
}

export function ComponentPreview({
Expand All @@ -31,6 +33,7 @@ export function ComponentPreview({
extractClassname,
extractedClassNames,
align = "center",
description,
...props
}: ComponentPreviewProps) {
const [config] = useConfig()
Expand Down Expand Up @@ -61,7 +64,7 @@ export function ComponentPreview({
if (
typeof Code?.props["data-rehype-pretty-code-fragment"] !== "undefined"
) {
const [, Button] = React.Children.toArray(
const [Button] = React.Children.toArray(
Code.props.children
) as React.ReactElement[]
return Button?.props?.value || Button?.props?.__rawString__ || null
Expand Down Expand Up @@ -93,14 +96,23 @@ export function ComponentPreview({
<TabsContent value="preview" className="relative rounded-md border">
<div className="flex items-center justify-between p-4">
<StyleSwitcher />
{extractedClassNames ? (
<CopyWithClassNames
<div className="flex items-center gap-2">
{config.style === "default" && description ? (
<V0Button
block={{
code: codeString,
name,
style: config.style,
description,
}}
/>
) : null}
<CopyButton
value={codeString}
classNames={extractedClassNames}
variant="outline"
className="h-7 w-7 text-foreground opacity-100 hover:bg-muted hover:text-foreground [&_svg]:size-3.5"
/>
) : (
codeString && <CopyButton value={codeString} />
)}
</div>
</div>
<ThemeWrapper defaultTheme="zinc">
<div
Expand Down
21 changes: 9 additions & 12 deletions apps/www/components/copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

import * as React from "react"
import { DropdownMenuTriggerProps } from "@radix-ui/react-dropdown-menu"
import { CheckIcon, CopyIcon } from "@radix-ui/react-icons"
import { CheckIcon, ClipboardIcon } from "lucide-react"
import { NpmCommands } from "types/unist"

import { Event, trackEvent } from "@/lib/events"
import { cn } from "@/lib/utils"
import { Button } from "@/registry/new-york/ui/button"
import { Button, ButtonProps } from "@/registry/new-york/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/registry/new-york/ui/dropdown-menu"

interface CopyButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
interface CopyButtonProps extends ButtonProps {
value: string
src?: string
event?: Event["name"]
Expand All @@ -32,6 +32,7 @@ export function CopyButton({
value,
className,
src,
variant = "ghost",
event,
...props
}: CopyButtonProps) {
Expand All @@ -46,9 +47,9 @@ export function CopyButton({
return (
<Button
size="icon"
variant="ghost"
variant={variant}
className={cn(
"relative z-10 h-6 w-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50",
"relative z-10 h-6 w-6 text-zinc-50 hover:bg-zinc-700 hover:text-zinc-50 [&_svg]:size-3",
className
)}
onClick={() => {
Expand All @@ -68,11 +69,7 @@ export function CopyButton({
{...props}
>
<span className="sr-only">Copy</span>
{hasCopied ? (
<CheckIcon className="h-3 w-3" />
) : (
<CopyIcon className="h-3 w-3" />
)}
{hasCopied ? <CheckIcon /> : <ClipboardIcon />}
</Button>
)
}
Expand Down Expand Up @@ -116,7 +113,7 @@ export function CopyWithClassNames({
{hasCopied ? (
<CheckIcon className="h-3 w-3" />
) : (
<CopyIcon className="h-3 w-3" />
<ClipboardIcon className="h-3 w-3" />
)}
<span className="sr-only">Copy</span>
</Button>
Expand Down Expand Up @@ -178,7 +175,7 @@ export function CopyNpmCommandButton({
{hasCopied ? (
<CheckIcon className="h-3 w-3" />
) : (
<CopyIcon className="h-3 w-3" />
<ClipboardIcon className="h-3 w-3" />
)}
<span className="sr-only">Copy</span>
</Button>
Expand Down
4 changes: 2 additions & 2 deletions apps/www/components/page-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function PageHeaderHeading({
return (
<h1
className={cn(
"text-center text-3xl font-bold leading-tight tracking-tighter md:text-6xl lg:leading-[1.1]",
"text-center text-3xl font-bold leading-tight tracking-tighter md:text-5xl lg:leading-[1.1]",
className
)}
{...props}
Expand All @@ -42,7 +42,7 @@ function PageHeaderDescription({
return (
<Balance
className={cn(
"max-w-[750px] text-center text-lg text-muted-foreground sm:text-xl",
"max-w-[750px] text-center text-lg font-light text-foreground",
className
)}
{...props}
Expand Down
1 change: 1 addition & 0 deletions apps/www/content/docs/components/accordion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ links:
<ComponentPreview
name="accordion-demo"
className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"
description="An accordion with items"
/>

## Installation
Expand Down
5 changes: 4 additions & 1 deletion apps/www/content/docs/components/alert-dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ links:
api: https://www.radix-ui.com/docs/primitives/components/alert-dialog#api-reference
---

<ComponentPreview name="alert-dialog-demo" />
<ComponentPreview
name="alert-dialog-demo"
description="An alert dialog with cancel and continue buttons."
/>

## Installation

Expand Down
15 changes: 12 additions & 3 deletions apps/www/content/docs/components/alert.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ description: Displays a callout for user attention.
component: true
---

<ComponentPreview name="alert-demo" />
<ComponentPreview
name="alert-demo"
description="An alert with an icon, title and description. The title says 'Heads up!' and the description is 'You can add components to your app using the cli.'."
/>

## Installation

Expand Down Expand Up @@ -58,8 +61,14 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"

### Default

<ComponentPreview name="alert-demo" />
<ComponentPreview
name="alert-demo"
description="An alert with an icon, title and description. The title says 'Heads up!' and the description is 'You can add components to your app using the cli.'."
/>

### Destructive

<ComponentPreview name="alert-destructive" />
<ComponentPreview
name="alert-destructive"
description="An alert with a destructive variant. The title says 'Delete this item?' and the description is 'This action cannot be undone.'."
/>
2 changes: 1 addition & 1 deletion apps/www/content/docs/components/avatar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ links:
api: https://www.radix-ui.com/docs/primitives/components/avatar#api-reference
---

<ComponentPreview name="avatar-demo" />
<ComponentPreview name="avatar-demo" description="An avatar with a fallback." />

## Installation

Expand Down
16 changes: 11 additions & 5 deletions apps/www/content/docs/components/badge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Displays a badge or a component that looks like a badge.
component: true
---

<ComponentPreview name="badge-demo" />
<ComponentPreview name="badge-demo" description="A badge" />

## Installation

Expand Down Expand Up @@ -64,22 +64,28 @@ import { badgeVariants } from "@/components/ui/badge"

### Default

<ComponentPreview name="badge-demo" />
<ComponentPreview name="badge-demo" description="A badge" />

---

### Secondary

<ComponentPreview name="badge-secondary" />
<ComponentPreview
name="badge-secondary"
description="A badge using secondary as variant."
/>

---

### Outline

<ComponentPreview name="badge-outline" />
<ComponentPreview
name="badge-outline"
description="A badge using outline as variant."
/>

---

### Destructive

<ComponentPreview name="badge-destructive" />
<ComponentPreview name="badge-destructive" description="A destructive badge." />
Loading

0 comments on commit d6427c9

Please sign in to comment.