Skip to content

Latest commit

 

History

History
64 lines (53 loc) · 1.46 KB

commit-copy-action.mdx

File metadata and controls

64 lines (53 loc) · 1.46 KB
title description
CommitCopyActions
CommitCopyActions component

The CommitCopyActions 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.

import { DocsPage } from "@/components/docs-page";

<DocsPage.ComponentExample client:only code={`

<CommitCopyActions sha="abc1234" toCommitDetails={({ sha }) => "/commit/" + sha} />

`} />

Usage

import { CommitCopyActions } from '@harnessio/ui/components'

// ...

return (
  <div className="flex">
    <CommitCopyActions
      sha="abc1234"
      toCommitDetails={({ sha }) => `/commit/${sha}`}
    />
  </div>
)

API Reference

The CommitCopyActions component provides action to copy commit sha to clipboard and navigate to commit details page.

<div className="flex">
  <CommitCopyActions
    sha="abc1234"
    toCommitDetails={({ sha }) => `/commit/${sha}`}
  />
</div>

<DocsPage.PropsTable props={[ { name: "sha", description: "The commit SHA to display and copy. This will be shown in the UI and can be copied to clipboard.", required: true, value: "string", }, { name: "toCommitDetails", description: "Function that takes the SHA and returns a URL for navigating to the commit details page", required: false, value: "({ sha }: { sha: string }) => string", }, ]} />