"use client"; import { Textarea } from "@openstatus/ui/components/ui/textarea"; import { cn } from "@openstatus/ui/lib/utils"; import { type VariantProps, cva } from "class-variance-authority"; import { format } from "date-fns"; import { useState } from "react"; import { HoverCardTimestamp } from "@/components/common/hover-card-timestamp"; import { useHydrated } from "@/hooks/use-hydrated"; export function DetailHeader({ children, className, ...props }: React.ComponentProps<"header">) { return (
{children}
); } export function DetailEyebrow({ children, className, ...props }: React.ComponentProps<"div">) { return (
{children}
); } export function DetailActions({ children, className, ...props }: React.ComponentProps<"div">) { return (
{children}
); } /** Title on the left, `DetailActions` on the right, on one line. */ export function DetailTitleRow({ children, className, ...props }: React.ComponentProps<"div">) { return (
{children}
); } export function DetailTitle({ children, className, ...props }: React.ComponentProps<"h1">) { return (

{children}

); } export function DetailDescription({ children, className, ...props }: React.ComponentProps<"p">) { return (

{children}

); } /** Edit-in-place field for `DetailTitle` / `DetailDescription`; commits on blur. */ export function DetailInput({ value, onCommit, multiline = false, className, ...props }: Omit< React.ComponentProps, "value" | "defaultValue" | "onBlur" | "onKeyDown" | "onInput" > & { value: string; onCommit: (value: string) => void; multiline?: boolean; }) { // Keyed by the server value: a new one resets the draft as it remounts. const [draft, setDraft] = useState({ base: value, text: value }); const text = draft.base === value ? draft.text : value; return ( {/* Invisible mirror in the same cell sizes the textarea in every browser. */}