feat(playground): add PlaygroundPage component with tabbed interface and update sidebar navigation
This commit is contained in:
parent
b6a4c3182e
commit
9b2177fea3
@ -17,6 +17,7 @@
|
||||
"@radix-ui/react-select": "^2.1.2",
|
||||
"@radix-ui/react-separator": "^1.1.0",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
"@radix-ui/react-tabs": "^1.1.2",
|
||||
"@radix-ui/react-tooltip": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
|
56
src/app/dashboard/playground/page.tsx
Normal file
56
src/app/dashboard/playground/page.tsx
Normal file
@ -0,0 +1,56 @@
|
||||
import { Bot, Columns2, FileCode } from "lucide-react";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
|
||||
export default function PlaygroundPage() {
|
||||
return (
|
||||
<div className="flex h-full flex-col w-full">
|
||||
<Tabs defaultValue="split" className="flex-1">
|
||||
<div className="h-full w-full px-3">
|
||||
<div className="grid h-full items-stretch gap-6 md:grid-cols-[1fr_200px]">
|
||||
<div className="hidden flex-col space-y-4 sm:flex md:order-2">
|
||||
<div className="grid gap-2">
|
||||
<TabsList className="grid grid-cols-3">
|
||||
<TabsTrigger value="split">
|
||||
<span className="sr-only">Split</span>
|
||||
<Columns2 className="h-5 w-auto" />
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="editor">
|
||||
<span className="sr-only">Editor</span>
|
||||
<FileCode className="h-5 w-auto" />
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="diff">
|
||||
<span className="sr-only">Diff</span>
|
||||
<Bot className="h-5 w-auto" />
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</div>
|
||||
</div>
|
||||
<div className="md:order-1">
|
||||
<TabsContent value="split" className="h-full mt-0 border-0 p-0">
|
||||
<div className="h-full flex flex-col space-y-4 pb-3">
|
||||
<div className="grid h-full grid-rows-2 gap-6 lg:grid-cols-2 lg:grid-rows-1">
|
||||
<div className="h-full min-h-[300px] lg:min-h-[700px] xl:min-h-[700px] bg-muted/50" />
|
||||
<div className="rounded-md border bg-muted"></div>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="editor" className="h-full mt-0 border-0 p-0">
|
||||
<div className="h-full flex flex-col space-y-4 pb-3">
|
||||
<div className="h-full min-h-[400px] flex-1 p-4 md:min-h-[700px] lg:min-h-[700px] bg-muted/50" />
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="diff" className="h-full mt-0 border-0 p-0">
|
||||
<div className="h-full flex flex-col space-y-4 pb-3">
|
||||
<div className="grid h-full grid-rows-2 gap-6 lg:grid-cols-2 lg:grid-rows-1">
|
||||
<div className="h-full min-h-[300px] lg:min-h-[700px] xl:min-h-[700px] bg-muted/50" />
|
||||
<div className="rounded-md border bg-muted"></div>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -41,7 +41,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
||||
navMain: [
|
||||
{
|
||||
title: "Playground",
|
||||
url: "#",
|
||||
url: "/dashboard/playground",
|
||||
icon: SquareTerminal,
|
||||
isActive: true,
|
||||
items: [
|
||||
|
55
src/components/ui/tabs.tsx
Normal file
55
src/components/ui/tabs.tsx
Normal file
@ -0,0 +1,55 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const Tabs = TabsPrimitive.Root
|
||||
|
||||
const TabsList = React.forwardRef<
|
||||
React.ElementRef<typeof TabsPrimitive.List>,
|
||||
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<TabsPrimitive.List
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
TabsList.displayName = TabsPrimitive.List.displayName
|
||||
|
||||
const TabsTrigger = React.forwardRef<
|
||||
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
||||
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<TabsPrimitive.Trigger
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
||||
|
||||
const TabsContent = React.forwardRef<
|
||||
React.ElementRef<typeof TabsPrimitive.Content>,
|
||||
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
||||
>(({ className, ...props }, ref) => (
|
||||
<TabsPrimitive.Content
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
))
|
||||
TabsContent.displayName = TabsPrimitive.Content.displayName
|
||||
|
||||
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
Loading…
Reference in New Issue
Block a user