Skip to content

Commit a7f47ad

Browse files
committed
docs: added support for commit-copy-action
1 parent c4ab206 commit a7f47ad

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: Commit Copy Action
3+
description: Commit Copy Action component documentation
4+
---
5+
6+
The Commit Copy Action component provides a UI element for displaying a commit SHA and copying it to the clipboard. It also allows navigation to the commit details page.
7+
8+
import { DocsPage } from "@/components/docs-page";
9+
10+
<DocsPage.ComponentExample
11+
client:only
12+
code={`
13+
<div className="flex">
14+
<CommitCopyActions sha="abc1234" toCommitDetails={({ sha }) => \`/commit/\${sha}\`} />
15+
</div>`}
16+
/>
17+
18+
## Usage
19+
20+
```typescript jsx
21+
import { CommitCopyActions } from '@harnessio/ui/components'
22+
23+
return (
24+
<div className="flex">
25+
<CommitCopyActions
26+
sha="abc1234" // [REQUIRED] The commit SHA to display and copy
27+
toCommitDetails={({ sha }) => \`/commit/\${sha}\`} // [OPTIONAL] Function to generate commit details URL
28+
className="my-class" // [OPTIONAL] Additional CSS classes
29+
/>
30+
</div>
31+
)
32+
```
33+
34+
## API Reference
35+
36+
<DocsPage.PropsTable
37+
props={[
38+
{
39+
name: "sha",
40+
description: "The commit SHA to display and copy. This will be shown in the UI and can be copied to clipboard.",
41+
required: true,
42+
value: "string",
43+
},
44+
{
45+
name: "toCommitDetails",
46+
description: "Function that takes the SHA and returns a URL for navigating to the commit details page",
47+
required: false,
48+
value: "({ sha }: { sha: string }) => string",
49+
},
50+
{
51+
name: "className",
52+
description: "Additional CSS classes to apply to the component",
53+
required: false,
54+
value: "string",
55+
},
56+
]}
57+
/>

0 commit comments

Comments
 (0)