Skip to content
+

Github Commit

Render a single commit with the contributor, commit message, changed files, and a compact diff view.

Usage

import { GithubCommit } from '@stoked-ui/github';
import { getApiUrl } from 'docs/src/modules/utils/getApiUrl';

<GithubCommit
  owner="stoked-ui"
  repo="sui"
  commitRef="5c90b548a6a5af958d7aa31f78a794874c007886"
  apiUrl={getApiUrl('/api/github/commit')}
/>

Private snapshots

Private mode skips runtime fetching and renders from static JSON generated during docs dev/build.

import { GithubCommit } from '@stoked-ui/github';
import commitSnapshot from '../../snapshots/github-commit-private.json';

<GithubCommit
  owner="stoked-ui"
  repo="sui"
  commitRef={commitSnapshot.ref}
  private
  data={commitSnapshot}
/>

The docs snapshots are refreshed with pnpm github:snapshots.

Demos

Public repo runtime

For public repositories, the component can query GitHub directly at runtime.

stoked-ui/sui
5c90b548a6a5af958d7aa31f78a794874c007886

5c90b548a6a5af958d7aa31f78a794874c007886

Press Enter to start editing

Runtime through a docs API route

Use apiUrl when you want runtime fetching to flow through a server-side helper.

stoked-ui/sui
5c90b548a6a5af958d7aa31f78a794874c007886

5c90b548a6a5af958d7aa31f78a794874c007886

Press Enter to start editing

Private static snapshot

Use private and pre-generated data when the source repository should stay private at deploy time.

stoked-ui/sui
5c90b54
6 files changed

add other tracks to demo video

Committed 9/18/2024, 6:33:59 PM

Contributor
brian-stoker

brian-stoker

Brian Stoker
1 commit
Brian Stoker

add other tracks to demo video

Brian Stoker committed 2024-09-18T18:33:59Z

Press Enter to start editing