Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="en-US">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link
Expand Down
219 changes: 102 additions & 117 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OpenInV0Button } from "@/components/open-in-v0-button";
import { ComponentCard } from "@/components/component-card";
import { HelloWorld } from "@/registry/new-york/blocks/hello-world/hello-world";
import { ExampleForm } from "@/registry/new-york/blocks/example-form/example-form";
import PokemonPage from "@/registry/new-york/blocks/complex-component/page";
Expand All @@ -9,8 +9,11 @@ import { ImagePreviewExample } from "@/registry/new-york/blocks/image-preview/ex
import { FilePreviewExample } from "@/registry/new-york/blocks/file-preview/example";
import { ScrollBoundaryExample } from "@/registry/new-york/blocks/scroll-boundary/example";
import { ScrollListExample } from "@/registry/new-york/blocks/scroll-list/example";
// This page displays items from the custom registry.
// You are free to implement this with your own design as needed.
import { ArrayFieldExample } from "@/registry/new-york/blocks/array-field/example";
import { BadgeInputExample } from "@/registry/new-york/blocks/badge-input/example";
import { RangeInputExample } from "@/registry/new-york/blocks/range-input/example";
import { FilePickerExample } from "@/registry/new-york/blocks/file-picker/example";
import { FormFieldExample } from "@/registry/new-york/blocks/form-field/example";

export default function Home() {
return (
Expand All @@ -22,129 +25,111 @@ export default function Home() {
</p>
</header>
<main className="flex flex-col flex-1 gap-8">
<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A simple hello world component
</h2>
<OpenInV0Button name="hello-world" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<HelloWorld />
</div>
</div>
<ComponentCard
name="hello-world"
description="A simple hello world component"
>
<HelloWorld />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A contact form with Zod validation.
</h2>
<OpenInV0Button name="example-form" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[500px] relative">
<ExampleForm />
</div>
</div>
<ComponentCard
name="example-form"
description="A contact form with Zod validation."
minHeight="min-h-[500px]"
>
<ExampleForm />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A complex component showing hooks, libs and components.
</h2>
<OpenInV0Button name="complex-component" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<PokemonPage />
</div>
</div>
<ComponentCard
name="complex-component"
description="A complex component showing hooks, libs and components."
>
<PokemonPage />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A login form with a CSS file.
</h2>
<OpenInV0Button name="example-with-css" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<ExampleCard />
</div>
</div>
<ComponentCard
name="example-with-css"
description="A login form with a CSS file."
>
<ExampleCard />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A component for displaying a list of badges with optional click
and delete handlers.
</h2>
<OpenInV0Button name="badge-bar" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<BadgeBarExample />
</div>
</div>
<ComponentCard
name="badge-bar"
description="A component for displaying a list of badges with optional click and delete handlers."
>
<BadgeBarExample />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A pagination component with page size and page index controls.
</h2>
<OpenInV0Button name="pager" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<PagerExample />
</div>
</div>
<ComponentCard
name="pager"
description="A pagination component with page size and page index controls."
>
<PagerExample />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
An image preview component with modal viewing and download
functionality.
</h2>
<OpenInV0Button name="image-preview" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<ImagePreviewExample />
</div>
</div>
<ComponentCard
name="image-preview"
description="An image preview component with modal viewing and download functionality."
>
<ImagePreviewExample />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A file preview component supporting images, audio, video, and
documents.
</h2>
<OpenInV0Button name="file-preview" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<FilePreviewExample />
</div>
</div>
<ComponentCard
name="file-preview"
description="A file preview component supporting images, audio, video, and documents."
>
<FilePreviewExample />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
A component that detects when scroll reaches edges using
IntersectionObserver.
</h2>
<OpenInV0Button name="scroll-boundary" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<ScrollBoundaryExample />
</div>
</div>
<ComponentCard
name="scroll-boundary"
description="A component that detects when scroll reaches edges using IntersectionObserver."
>
<ScrollBoundaryExample />
</ComponentCard>

<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">
An infinite scroll list component using MobX for state management.
</h2>
<OpenInV0Button name="scroll-list" className="w-fit" />
</div>
<div className="flex items-center justify-center min-h-[400px] relative">
<ScrollListExample />
</div>
</div>
<ComponentCard
name="scroll-list"
description="An infinite scroll list component using MobX for state management."
>
<ScrollListExample />
</ComponentCard>

<ComponentCard
name="array-field"
description="A dynamic array field component with add/remove functionality for form arrays."
>
<ArrayFieldExample />
</ComponentCard>

<ComponentCard
name="badge-input"
description="An input component that displays values as removable badges, supporting multiple entries."
>
<BadgeInputExample />
</ComponentCard>

<ComponentCard
name="range-input"
description="A range slider input with optional custom icon display for each step."
>
<RangeInputExample />
</ComponentCard>

<ComponentCard
name="file-picker"
description="A file picker component with preview and remove functionality."
>
<FilePickerExample />
</ComponentCard>

<ComponentCard
name="form-field"
description="A unified form field component supporting input, textarea, and select elements with labels."
>
<FormFieldExample />
</ComponentCard>
</main>
</div>
);
Expand Down
26 changes: 26 additions & 0 deletions components/component-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FC, PropsWithChildren } from "react";

import { OpenInV0Button } from "./open-in-v0-button";

export type ComponentCardProps = PropsWithChildren<{
name: string;
description: string;
minHeight?: string;
}>;

export const ComponentCard: FC<ComponentCardProps> = ({
name,
description,
children,
minHeight = "min-h-[400px]",
}) => (
<div className="flex flex-col gap-4 border rounded-lg p-4 min-h-[450px] relative">
<div className="flex items-center justify-between">
<h2 className="text-sm text-muted-foreground sm:pl-3">{description}</h2>
<OpenInV0Button name={name} className="w-fit" />
</div>
<div className={`flex items-center justify-center ${minHeight} relative`}>
{children}
</div>
</div>
);
3 changes: 2 additions & 1 deletion components/index.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
badge
button
dialog
input
input
label
Loading