Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
907 B ยท 35 lines
TSX
123456789101112131415161718192021222324252627282930313233343536import React from "react";
import { CopyButton } from "../copy-button";
function extractTextFromReactNode(node: React.ReactNode): string { if (typeof node === "string") { return node; } if (typeof node === "number") { return String(node); } if (Array.isArray(node)) { return node.map(extractTextFromReactNode).join(""); } if (React.isValidElement(node)) { const props = node.props as { children?: React.ReactNode }; if (props.children) { return extractTextFromReactNode(props.children); } } return "";}
export function Pre({ children, ...props }: React.ComponentProps<"pre">) { const textContent = extractTextFromReactNode(children); return ( <div className="relative"> <pre {...props}>{children}</pre> <CopyButton copyText={textContent} className="absolute top-px right-px backdrop-blur-xs" /> </div> );}