forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemHeader.tsx
More file actions
51 lines (48 loc) · 1.79 KB
/
Copy pathItemHeader.tsx
File metadata and controls
51 lines (48 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use client";
import TextareaAutosize from "react-textarea-autosize";
import type React from "react";
export function ItemHeader(props: {
id: string;
name: string;
subtitle: string;
description: string;
onNameChange: (value: string) => void;
onSubtitleChange: (value: string) => void;
onNameCommit?: (value: string) => void;
onDescriptionCommit?: (value: string) => void;
}) {
const { id, name, subtitle, onNameChange, onSubtitleChange, onNameCommit } =
props;
return (
<div className="mb-4">
<div className="mb-2">
<span className="rounded-sm border border-dashed border-foreground/25 px-1 py-0.5 text-xs font-mono text-muted-foreground/50">
<span className="font-medium">ID:</span>
<span className="-tracking-widest"> </span>
<span className="tracking-wide">{id}</span>
</span>
</div>
<input
value={name}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
onNameChange(e.target.value)
}
onBlur={(e: React.FocusEvent<HTMLInputElement>) =>
onNameCommit?.(e.target.value)
}
placeholder="Item title"
className="w-full appearance-none text-2xl font-semibold outline-none placeholder:text-gray-400 transition-colors focus:text-accent focus:placeholder:text-accent/65"
/>
<TextareaAutosize
value={subtitle}
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>
onSubtitleChange(e.target.value)
}
placeholder="Optional subtitle or short description"
className="mt-2 w-full bg-transparent text-sm leading-6 resize-none outline-none placeholder:text-gray-400 transition-colors focus:text-accent focus:placeholder:text-accent/65"
minRows={1}
/>
</div>
);
}
export default ItemHeader;