94 lines · 2.7 KB
import { useState } from "react";
import { updateIssue } from "~/fns/issues";
import { useAction } from "~/hooks/use-action";
import { Badge } from "~/ui/Badge";
import { RelativeTime } from "~/ui/RelativeTime";
import { Button } from "~/ui/Button";
import { inputClass } from "~/ui/Field";
import { cn } from "~/utils/cn";
import { Heading } from "~/ui/Heading";

type Props = {
  owner: string;
  repo: string;
  number: number;
  title: string;
  state: "open" | "closed";
  merged?: boolean;
  draft?: boolean;
  author: string;
  createdAt: number;
  canEdit: boolean;
  subtitle?: React.ReactNode;
};

export function IssueHeader({
  owner,
  repo,
  number,
  title,
  state,
  merged = false,
  draft = false,
  author,
  createdAt,
  canEdit,
  subtitle,
}: Props) {
  const [editing, setEditing] = useState(false);
  const [value, setValue] = useState(title);
  const save = useAction(updateIssue);