From dc2b36db5d917f0b78478263ef9bd35093b7f429 Mon Sep 17 00:00:00 2001 From: Kegongteng Date: Tue, 25 Mar 2025 21:47:40 +0800 Subject: [PATCH] 1st --- app/favicon.ico | Bin 0 -> 165662 bytes app/globals.css | 94 ++++ app/gravatar/[...path]/route.ts | 120 +++++ app/layout.tsx | 19 + app/page.tsx | 264 +++++++++++ app/random-image/route.ts | 21 + components.json | 21 + components/theme-provider.tsx | 11 + components/ui/accordion.tsx | 58 +++ components/ui/alert-dialog.tsx | 141 ++++++ components/ui/alert.tsx | 59 +++ components/ui/aspect-ratio.tsx | 7 + components/ui/avatar.tsx | 50 ++ components/ui/badge.tsx | 36 ++ components/ui/breadcrumb.tsx | 115 +++++ components/ui/button.tsx | 56 +++ components/ui/calendar.tsx | 66 +++ components/ui/card.tsx | 79 ++++ components/ui/carousel.tsx | 262 ++++++++++ components/ui/chart.tsx | 365 ++++++++++++++ components/ui/checkbox.tsx | 30 ++ components/ui/collapsible.tsx | 11 + components/ui/command.tsx | 153 ++++++ components/ui/context-menu.tsx | 200 ++++++++ components/ui/dialog.tsx | 122 +++++ components/ui/drawer.tsx | 118 +++++ components/ui/dropdown-menu.tsx | 200 ++++++++ components/ui/form.tsx | 178 +++++++ components/ui/hover-card.tsx | 29 ++ components/ui/input-otp.tsx | 71 +++ components/ui/input.tsx | 22 + components/ui/label.tsx | 26 + components/ui/menubar.tsx | 236 +++++++++ components/ui/navigation-menu.tsx | 128 +++++ components/ui/pagination.tsx | 117 +++++ components/ui/popover.tsx | 31 ++ components/ui/progress.tsx | 28 ++ components/ui/radio-group.tsx | 44 ++ components/ui/resizable.tsx | 45 ++ components/ui/scroll-area.tsx | 48 ++ components/ui/select.tsx | 160 +++++++ components/ui/separator.tsx | 31 ++ components/ui/sheet.tsx | 140 ++++++ components/ui/sidebar.tsx | 763 ++++++++++++++++++++++++++++++ components/ui/skeleton.tsx | 15 + components/ui/slider.tsx | 28 ++ components/ui/sonner.tsx | 31 ++ components/ui/switch.tsx | 29 ++ components/ui/table.tsx | 117 +++++ components/ui/tabs.tsx | 55 +++ components/ui/textarea.tsx | 22 + components/ui/toast.tsx | 129 +++++ components/ui/toaster.tsx | 35 ++ components/ui/toggle-group.tsx | 61 +++ components/ui/toggle.tsx | 45 ++ components/ui/tooltip.tsx | 30 ++ components/ui/use-mobile.tsx | 19 + components/ui/use-toast.ts | 194 ++++++++ hooks/use-mobile.tsx | 19 + hooks/use-toast.ts | 194 ++++++++ lib/utils.ts | 6 + next.config.mjs | 48 ++ package.json | 70 +++ pnpm-lock.yaml | 5 + postcss.config.mjs | 8 + public/placeholder-logo.png | Bin 0 -> 958 bytes public/placeholder-logo.svg | 1 + public/placeholder-user.jpg | Bin 0 -> 2615 bytes public/placeholder.jpg | Bin 0 -> 1596 bytes public/placeholder.svg | 1 + styles/globals.css | 94 ++++ tailwind.config.ts | 96 ++++ tsconfig.json | 27 ++ 73 files changed, 6154 insertions(+) create mode 100644 app/favicon.ico create mode 100644 app/globals.css create mode 100644 app/gravatar/[...path]/route.ts create mode 100644 app/layout.tsx create mode 100644 app/page.tsx create mode 100644 app/random-image/route.ts create mode 100644 components.json create mode 100644 components/theme-provider.tsx create mode 100644 components/ui/accordion.tsx create mode 100644 components/ui/alert-dialog.tsx create mode 100644 components/ui/alert.tsx create mode 100644 components/ui/aspect-ratio.tsx create mode 100644 components/ui/avatar.tsx create mode 100644 components/ui/badge.tsx create mode 100644 components/ui/breadcrumb.tsx create mode 100644 components/ui/button.tsx create mode 100644 components/ui/calendar.tsx create mode 100644 components/ui/card.tsx create mode 100644 components/ui/carousel.tsx create mode 100644 components/ui/chart.tsx create mode 100644 components/ui/checkbox.tsx create mode 100644 components/ui/collapsible.tsx create mode 100644 components/ui/command.tsx create mode 100644 components/ui/context-menu.tsx create mode 100644 components/ui/dialog.tsx create mode 100644 components/ui/drawer.tsx create mode 100644 components/ui/dropdown-menu.tsx create mode 100644 components/ui/form.tsx create mode 100644 components/ui/hover-card.tsx create mode 100644 components/ui/input-otp.tsx create mode 100644 components/ui/input.tsx create mode 100644 components/ui/label.tsx create mode 100644 components/ui/menubar.tsx create mode 100644 components/ui/navigation-menu.tsx create mode 100644 components/ui/pagination.tsx create mode 100644 components/ui/popover.tsx create mode 100644 components/ui/progress.tsx create mode 100644 components/ui/radio-group.tsx create mode 100644 components/ui/resizable.tsx create mode 100644 components/ui/scroll-area.tsx create mode 100644 components/ui/select.tsx create mode 100644 components/ui/separator.tsx create mode 100644 components/ui/sheet.tsx create mode 100644 components/ui/sidebar.tsx create mode 100644 components/ui/skeleton.tsx create mode 100644 components/ui/slider.tsx create mode 100644 components/ui/sonner.tsx create mode 100644 components/ui/switch.tsx create mode 100644 components/ui/table.tsx create mode 100644 components/ui/tabs.tsx create mode 100644 components/ui/textarea.tsx create mode 100644 components/ui/toast.tsx create mode 100644 components/ui/toaster.tsx create mode 100644 components/ui/toggle-group.tsx create mode 100644 components/ui/toggle.tsx create mode 100644 components/ui/tooltip.tsx create mode 100644 components/ui/use-mobile.tsx create mode 100644 components/ui/use-toast.ts create mode 100644 hooks/use-mobile.tsx create mode 100644 hooks/use-toast.ts create mode 100644 lib/utils.ts create mode 100644 next.config.mjs create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 postcss.config.mjs create mode 100644 public/placeholder-logo.png create mode 100644 public/placeholder-logo.svg create mode 100644 public/placeholder-user.jpg create mode 100644 public/placeholder.jpg create mode 100644 public/placeholder.svg create mode 100644 styles/globals.css create mode 100644 tailwind.config.ts create mode 100644 tsconfig.json diff --git a/app/favicon.ico b/app/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..655ad59190498b0528d64362af224fe800193b1f GIT binary patch literal 165662 zcmeHQeXJG7b-(zv!SG%JF8QD#)9Pu_?yb4^08_W@}QpLMqO>l!b z;$7N!5wJ;aNRITTgxrr~-k(HyE6R41pF;UD6c$FHDgqB+pv-HNwM~v}h0h;F`5Tlc zQC>i~f|BL`521Sk<;y6aMY$X0-6(HDVPORF5O@*F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#-Ez}J{9c*2j!J$XA#}0MTBEg62D`|JQ5Ck!%gYP#Gp2RKGMT^u$cZ4T*%Aqa- zJ2W+rM**QO0ys|D6xi>PGSUr57g`GZ zT2ORh@YF!zMFFB-ZU~_Yx&B0aPsM`QdonQqcT^L}ObbZnVZbiB~WonSzM=L-Hqp&;!8p&M#_Y)KhiD4Z4PpDN`Sri zI3>V@P6==rAEyME(2Y1Y_ID8dAVNBtqU%c??R2mm42b?4NL|XfQGm&DqX2seo1*|1 z61q`<-GpuwV0_&%zmSe5I34X#Nsj>WKYEX3K@(M#AI1+kFO zML}%ubh=4hAG35;4Cs$5Hpb=)ommN&XulTI1 = { + $upstream: "$custom_domain", + "//gravatar.com": "", +} + +export async function GET(request: NextRequest, { params }: { params: { path: string[] } }) { + const url = new URL(request.url) + const url_host = url.host + const user_agent = request.headers.get("user-agent") || "" + + // Determine if it's a mobile device + const is_desktop = await device_status(user_agent) + const upstream_domain = is_desktop ? upstream : upstream_mobile + + // Construct the upstream URL + const path = params.path.join("/") + const upstream_url = `https://${upstream_domain}/${path}${url.search}` + + try { + // Fetch from upstream + const upstream_response = await fetch(upstream_url, { + headers: { + Host: upstream_domain, + "User-Agent": user_agent, + Referer: url.href, + }, + }) + + // Clone the response so we can read it multiple times + const original_response = upstream_response.clone() + + // Get the response headers + const response_headers = new Headers(upstream_response.headers) + + // Set CORS headers + response_headers.set("access-control-allow-origin", "*") + response_headers.set("access-control-allow-credentials", "true") + + // Remove security headers that might cause issues + response_headers.delete("content-security-policy") + response_headers.delete("content-security-policy-report-only") + response_headers.delete("clear-site-data") + + // Get the content type + const content_type = response_headers.get("content-type") || "" + + // Process the response body + let response_body + if (content_type.includes("text/html") && content_type.includes("UTF-8")) { + // If it's HTML, replace text + const text = await original_response.text() + response_body = replace_response_text(text, upstream_domain, url_host) + } else { + // Otherwise, just pass through the body + response_body = original_response.body + } + + // Create and return the new response + return new NextResponse(response_body, { + status: upstream_response.status, + headers: response_headers, + }) + } catch (error) { + console.error("Gravatar proxy error:", error) + return new NextResponse("Error proxying to Gravatar", { status: 500 }) + } +} + +// Helper function to determine if the request is from a desktop device +function device_status(user_agent_info: string): boolean { + const agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"] + let flag = true + for (let v = 0; v < agents.length; v++) { + if (user_agent_info.indexOf(agents[v]) > 0) { + flag = false + break + } + } + return flag +} + +// Helper function to replace text in the response +function replace_response_text(text: string, upstream_domain: string, host_name: string): string { + for (const [i, j] of Object.entries(replace_dict)) { + let from = i + let to = j + + if (from === "$upstream") { + from = upstream_domain + } else if (from === "$custom_domain") { + from = host_name + } + + if (to === "$upstream") { + to = upstream_domain + } else if (to === "$custom_domain") { + to = host_name + } + + const re = new RegExp(from, "g") + text = text.replace(re, to) + } + return text +} + diff --git a/app/layout.tsx b/app/layout.tsx new file mode 100644 index 0000000..3323586 --- /dev/null +++ b/app/layout.tsx @@ -0,0 +1,19 @@ +import type { Metadata } from 'next' +import './globals.css' + +export const metadata: Metadata = { + title: 'Spircape API', + description: 'Spircape API', +} + +export default function RootLayout({ + children, +}: Readonly<{ + children: React.ReactNode +}>) { + return ( + + {children} + + ) +} diff --git a/app/page.tsx b/app/page.tsx new file mode 100644 index 0000000..ce53a47 --- /dev/null +++ b/app/page.tsx @@ -0,0 +1,264 @@ +"use client" + +import { useState } from "react" +import { Copy, CheckCheck, ExternalLink, ImageIcon, UserCircle, Code } from "lucide-react" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" +import { AlertTriangle } from "lucide-react" +import { Badge } from "@/components/ui/badge" + +export default function Home() { + const [copied, setCopied] = useState(null) + const baseUrl = typeof window !== "undefined" ? window.location.origin : "" + const randomImageUrl = `${baseUrl}/random-image` + const gravatarProxyUrl = `${baseUrl}/gravatar` + + const copyToClipboard = (text: string, id: string) => { + navigator.clipboard.writeText(text) + setCopied(id) + setTimeout(() => setCopied(null), 2000) + } + + return ( +
+
+
+

+ API Services +

+

+ Connect the world with us +

+
+ + + + Access Restricted + + The API is not open to the public. If you need it, please contact us at{" "} + + 10010@spircape.com + + + + + + + + + Integration Guide + + Follow these examples to integrate our services into your application + + + + + + + Random Image + + + + Gravatar Proxy + + + + +
+
+

Random Image API

+ + GET + +
+

+ This API randomly serves an image from a predefined collection. Perfect for placeholder images, + random backgrounds, or testing purposes. +

+ +
+
+

+ + HTML Usage +

+
+
+                          {`Random image`}
+                        
+ +
+
+ +
+

+ + React Usage +

+
+
+                          {`import { useState } from 'react';\n\nfunction RandomImage() {\n  const [refresh, setRefresh] = useState(0);\n  \n  return (\n    Random image setRefresh(Date.now())}\n      className="cursor-pointer transition-opacity hover:opacity-90"\n    />\n  );\n}`}
+                        
+ +
+
+
+
+
+ + +
+
+

Gravatar Proxy

+ + GET + +
+

+ Our Gravatar proxy service improves loading speed and reliability for Gravatar images. It caches and + optimizes avatar delivery for your applications. +

+ +
+
+

+ + Basic Usage +

+
+
+                          {`\nUser avatar`}
+                        
+ +
+
+ +
+

+ + With Size Parameter +

+
+
+                          {`\nUser avatar`}
+                        
+ +
+
+ +
+

+ + With Default Image +

+
+
+                          {`\nUser avatar`}
+                        
+ +
+
+
+
+
+
+
+ +
+ + The above is for example only, please adjust according to the specific development environment +
+
+
+ +
+
+

© {new Date().getFullYear()} Spircape. All rights reserved.

+
+
+
+
+ ) +} + diff --git a/app/random-image/route.ts b/app/random-image/route.ts new file mode 100644 index 0000000..893b856 --- /dev/null +++ b/app/random-image/route.ts @@ -0,0 +1,21 @@ +import { type NextRequest, NextResponse } from "next/server" + +export async function GET(request: NextRequest) { + // List of image URLs + const imageUrls = [ + "https://zh.yuazhi.cn/apipng/18CD3BE92227887D576B2D4B7A9C9960.jpg", + "https://zh.yuazhi.cn/apipng/1.jpg", + "https://zh.yuazhi.cn/apipng/2.jpg", + "https://zh.yuazhi.cn/apipng/3.jpg", + "https://zh.yuazhi.cn/apipng/4.jpg", + "https://zh.yuazhi.cn/apipng/5.jpg", + ] + + // Select a random image URL + const randomIndex = Math.floor(Math.random() * imageUrls.length) + const randomImageUrl = imageUrls[randomIndex] + + // Redirect to the random image + return NextResponse.redirect(randomImageUrl) +} + diff --git a/components.json b/components.json new file mode 100644 index 0000000..d9ef0ae --- /dev/null +++ b/components.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": true, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "app/globals.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "@/components", + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" +} \ No newline at end of file diff --git a/components/theme-provider.tsx b/components/theme-provider.tsx new file mode 100644 index 0000000..55c2f6e --- /dev/null +++ b/components/theme-provider.tsx @@ -0,0 +1,11 @@ +'use client' + +import * as React from 'react' +import { + ThemeProvider as NextThemesProvider, + type ThemeProviderProps, +} from 'next-themes' + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return {children} +} diff --git a/components/ui/accordion.tsx b/components/ui/accordion.tsx new file mode 100644 index 0000000..24c788c --- /dev/null +++ b/components/ui/accordion.tsx @@ -0,0 +1,58 @@ +"use client" + +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDown } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Accordion = AccordionPrimitive.Root + +const AccordionItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AccordionItem.displayName = "AccordionItem" + +const AccordionTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + svg]:rotate-180", + className + )} + {...props} + > + {children} + + + +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName + +const AccordionContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + +
{children}
+
+)) + +AccordionContent.displayName = AccordionPrimitive.Content.displayName + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/components/ui/alert-dialog.tsx b/components/ui/alert-dialog.tsx new file mode 100644 index 0000000..25e7b47 --- /dev/null +++ b/components/ui/alert-dialog.tsx @@ -0,0 +1,141 @@ +"use client" + +import * as React from "react" +import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" + +import { cn } from "@/lib/utils" +import { buttonVariants } from "@/components/ui/button" + +const AlertDialog = AlertDialogPrimitive.Root + +const AlertDialogTrigger = AlertDialogPrimitive.Trigger + +const AlertDialogPortal = AlertDialogPrimitive.Portal + +const AlertDialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName + +const AlertDialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + +)) +AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName + +const AlertDialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogHeader.displayName = "AlertDialogHeader" + +const AlertDialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +AlertDialogFooter.displayName = "AlertDialogFooter" + +const AlertDialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName + +const AlertDialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogDescription.displayName = + AlertDialogPrimitive.Description.displayName + +const AlertDialogAction = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName + +const AlertDialogCancel = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName + +export { + AlertDialog, + AlertDialogPortal, + AlertDialogOverlay, + AlertDialogTrigger, + AlertDialogContent, + AlertDialogHeader, + AlertDialogFooter, + AlertDialogTitle, + AlertDialogDescription, + AlertDialogAction, + AlertDialogCancel, +} diff --git a/components/ui/alert.tsx b/components/ui/alert.tsx new file mode 100644 index 0000000..41fa7e0 --- /dev/null +++ b/components/ui/alert.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const alertVariants = cva( + "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground", + { + variants: { + variant: { + default: "bg-background text-foreground", + destructive: + "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +const Alert = React.forwardRef< + HTMLDivElement, + React.HTMLAttributes & VariantProps +>(({ className, variant, ...props }, ref) => ( +
+)) +Alert.displayName = "Alert" + +const AlertTitle = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertTitle.displayName = "AlertTitle" + +const AlertDescription = React.forwardRef< + HTMLParagraphElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +AlertDescription.displayName = "AlertDescription" + +export { Alert, AlertTitle, AlertDescription } diff --git a/components/ui/aspect-ratio.tsx b/components/ui/aspect-ratio.tsx new file mode 100644 index 0000000..d6a5226 --- /dev/null +++ b/components/ui/aspect-ratio.tsx @@ -0,0 +1,7 @@ +"use client" + +import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" + +const AspectRatio = AspectRatioPrimitive.Root + +export { AspectRatio } diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx new file mode 100644 index 0000000..51e507b --- /dev/null +++ b/components/ui/avatar.tsx @@ -0,0 +1,50 @@ +"use client" + +import * as React from "react" +import * as AvatarPrimitive from "@radix-ui/react-avatar" + +import { cn } from "@/lib/utils" + +const Avatar = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +Avatar.displayName = AvatarPrimitive.Root.displayName + +const AvatarImage = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarImage.displayName = AvatarPrimitive.Image.displayName + +const AvatarFallback = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName + +export { Avatar, AvatarImage, AvatarFallback } diff --git a/components/ui/badge.tsx b/components/ui/badge.tsx new file mode 100644 index 0000000..f000e3e --- /dev/null +++ b/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import * as React from "react" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "@/lib/utils" + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +) + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ) +} + +export { Badge, badgeVariants } diff --git a/components/ui/breadcrumb.tsx b/components/ui/breadcrumb.tsx new file mode 100644 index 0000000..60e6c96 --- /dev/null +++ b/components/ui/breadcrumb.tsx @@ -0,0 +1,115 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { ChevronRight, MoreHorizontal } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Breadcrumb = React.forwardRef< + HTMLElement, + React.ComponentPropsWithoutRef<"nav"> & { + separator?: React.ReactNode + } +>(({ ...props }, ref) =>