-
Notifications
You must be signed in to change notification settings - Fork 307
Expand file tree
/
Copy pathcommitMessage.tsx
More file actions
31 lines (27 loc) · 964 Bytes
/
Copy pathcommitMessage.tsx
File metadata and controls
31 lines (27 loc) · 964 Bytes
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
'use client';
import { CommitBody, CommitBodyToggle } from "@/app/(app)/browse/components/commitParts";
import { useState } from "react";
interface CommitMessageProps {
subject: string;
body: string;
}
export const CommitMessage = ({ subject, body }: CommitMessageProps) => {
const [isBodyExpanded, setIsBodyExpanded] = useState(false);
const hasBody = body.trim().length > 0;
return (
<>
<div className="flex flex-row items-center gap-2">
<h1 className="text-lg font-semibold">{subject}</h1>
{hasBody && (
<CommitBodyToggle
pressed={isBodyExpanded}
onPressedChange={setIsBodyExpanded}
/>
)}
</div>
{hasBody && isBodyExpanded && (
<CommitBody body={body} className="rounded max-h-[40vh] overflow-y-auto" />
)}
</>
);
};