play around with inventory demo

main
radex 2023-07-14 21:53:09 +02:00
parent c7925b2316
commit dbdf854223
3 changed files with 174 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { Metadata } from "next"
export const metadata: Metadata = {
title: "Inventory Test",
description: "Inventory Test",
}
interface SettingsLayoutProps {
children: React.ReactNode
}
export default function SettingsLayout({ children }: SettingsLayoutProps) {
return (
<>
<div className="flex flex-row">
<div className="flex-1">{children}</div>
</div>
</>
)
}

View File

@ -0,0 +1,77 @@
import Link from "next/link"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Button } from "@/components/ui/button"
import { ModeToggle } from '@/components/ModeToggle'
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
function NavLink({ href, children }: { href: string; children: React.ReactNode }) {
return (
<Link href={href} className="text-sm font-medium text-muted-foreground transition-colors hover:text-primary">{children}</Link>
)
}
function MainNav() {
return (
<nav className="flex items-center space-x-6 pl-3">
<NavLink href="/inventory">Add thing</NavLink>
<NavLink href="/inventory">How to use</NavLink>
</nav>
)
}
function Search() {
return (
<div>
<Input type="search" placeholder="Search inventory…" className="w-[300px] lg:w-[450px]" />
</div>
)
}
function CreateThingCard() {
return (
<Card className="w-[800px]">
<CardHeader>
<CardTitle className="text-2xl">Create item</CardTitle>
{/* <CardDescription>Card Description</CardDescription> */}
</CardHeader>
<CardContent>
<div className="grid gap-2">
<Label htmlFor="name">Name</Label>
<Input id="name" placeholder="Item name" />
</div>
</CardContent>
<CardFooter>
<Button className="w-full">Create item</Button>
</CardFooter>
</Card>
)
}
export default function IventoryTestPage() {
return (
<>
<div className="border-b">
<div className="flex flex-row h-16 items-center px-4">
<div className="flex-1">
<MainNav />
</div>
<Search />
<div className="flex-1 flex flex-row justify-end">
<ModeToggle />
</div>
</div>
</div>
<div className="flex flex-row justify-center p-6">
<CreateThingCard />
</div>
</>
)
}

View File

@ -0,0 +1,76 @@
import * as React from "react"
import { cn } from "src/lib/utils"
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"rounded-xl border bg-card text-card-foreground shadow",
className
)}
{...props}
/>
))
Card.displayName = "Card"
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
{...props}
/>
))
CardHeader.displayName = "CardHeader"
const CardTitle = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
<h3
ref={ref}
className={cn("font-semibold leading-none tracking-tight", className)}
{...props}
/>
))
CardTitle.displayName = "CardTitle"
const CardDescription = React.forwardRef<
HTMLParagraphElement,
React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
<p
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
CardDescription.displayName = "CardDescription"
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
))
CardContent.displayName = "CardContent"
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(" flex items-center p-6 pt-0", className)}
{...props}
/>
))
CardFooter.displayName = "CardFooter"
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }