File tree 1 file changed +59
-0
lines changed
apps/portal/src/content/docs/components
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change
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"
27
+ toCommitDetails = {({ sha }) => ` /commit/${sha } ` }
28
+ className = " my-class"
29
+ / >
30
+ < / div >
31
+ )
32
+ ```
33
+
34
+ ## API Reference
35
+
36
+ <DocsPage.PropsTable
37
+ props = { [
38
+ {
39
+ name: " sha" ,
40
+ description:
41
+ " The commit SHA to display and copy. This will be shown in the UI and can be copied to clipboard." ,
42
+ required: true ,
43
+ value: " string" ,
44
+ },
45
+ {
46
+ name: " toCommitDetails" ,
47
+ description:
48
+ " Function that takes the SHA and returns a URL for navigating to the commit details page" ,
49
+ required: false ,
50
+ value: " ({ sha }: { sha: string }) => string" ,
51
+ },
52
+ {
53
+ name: " className" ,
54
+ description: " Additional CSS classes to apply to the component" ,
55
+ required: false ,
56
+ value: " string" ,
57
+ },
58
+ ]}
59
+ />
You can’t perform that action at this time.
0 commit comments