SPB Git
2.6 KB · 16 lines tsx
1"use client";2import * as React from "react";3import { Type, Hash, Calendar, CheckSquare, CircleDot, ChevronDownCircle, List, Link2, Paperclip, ArrowRightLeft, Sigma, FunctionSquare, Clock, History, Sparkles, Heading, Table2, Kanban, CalendarDays, LayoutGrid, GanttChart, Rows3 } from "lucide-react";4import type { PropertyType, ViewType } from "@/lib/databases/types";5import { cn } from "@/lib/utils";6export const TYPE_META: Record<PropertyType, { label: string; icon: React.ReactNode }> = {7  title: { label: "Title", icon: <Heading /> }, text: { label: "Text", icon: <Type /> }, number: { label: "Number", icon: <Hash /> }, date: { label: "Date", icon: <Calendar /> }, checkbox: { label: "Checkbox", icon: <CheckSquare /> },8  status: { label: "Status", icon: <CircleDot /> }, select: { label: "Select", icon: <ChevronDownCircle /> }, multi_select: { label: "Multi-select", icon: <List /> }, url: { label: "URL", icon: <Link2 /> }, file: { label: "Files", icon: <Paperclip /> },9  relation: { label: "Relation", icon: <ArrowRightLeft /> }, rollup: { label: "Rollup", icon: <Sigma /> }, formula: { label: "Formula", icon: <FunctionSquare /> }, created_time: { label: "Created time", icon: <Clock /> }, last_edited_time: { label: "Last edited", icon: <History /> }, ai: { label: "AI", icon: <Sparkles /> },10};11export const VIEW_META: Record<ViewType, { label: string; icon: React.ReactNode }> = { table: { label: "Table", icon: <Table2 /> }, board: { label: "Board", icon: <Kanban /> }, calendar: { label: "Calendar", icon: <CalendarDays /> }, gallery: { label: "Gallery", icon: <LayoutGrid /> }, timeline: { label: "Timeline", icon: <GanttChart /> }, list: { label: "List", icon: <Rows3 /> } };12export const TypeIcon = ({ type, className }: { type: PropertyType; className?: string }) => <span className={cn("inline-flex shrink-0 text-fg-faint [&_svg]:size-3.5", type === "ai" && "text-ai", className)}>{TYPE_META[type]?.icon}</span>;13export function Sel({ className, children, ...p }: React.SelectHTMLAttributes<HTMLSelectElement>) { return <select className={cn("h-8 max-w-full rounded-md border border-line bg-bg-elev px-2 text-[13px] outline-none focus:border-accent/50", className)} {...p}>{children}</select>; }14export const Field = ({ label, children, hint }: { label: string; children: React.ReactNode; hint?: string }) => <label className="block space-y-1"><span className="text-[12px] font-medium text-fg-muted">{label}</span>{children}{hint && <span className="block text-[11px] text-fg-faint">{hint}</span>}</label>;15export const inputCls = "h-8 w-full rounded-md border border-line bg-bg-elev px-2 text-[13px] outline-none placeholder:text-fg-faint focus:border-accent/50";16
Files · 2c37cb5a3e2af18e5ba361996d453cab97da82c2
Menu

Theme