summaryrefslogtreecommitdiff
path: root/src/components/Commit.astro
blob: 3ee284a993f2b090c1259ad0386881bad4cba9e8 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
import type { Commit } from "@lib/git/types";
import { gitDir } from "@lib/git";

type Props = Commit;

const { hash, files, author, signature } = Astro.props;

const git = await gitDir;
---
<p>Git commit info:</p>
<dl>
  <dt>Hash</dt>
  <dd>{hash}</dd>
  <dt>Files</dt>
  {files.map((file) => <dd>{file.pathname.replace(git, "")}</dd>)}
  <dt>Author</dt>
  <dd>{author.name} &lt;{author.email}&gt;</dd>
  {
    signature && (
      <dt>Commit Signature</dt>
      <dd>
        <dl>
          <dt>Type</dt>
          <dd>{signature.type}</dd>
          <dt>Signer</dt>
          <dd>{signature.signerName}</dd>
          <dt>Key fingerprint</dt>
          <dd>{signature.keyFingerPrint}</dd>
        </dl>
      </dd>
    )
  }
</dl>

<style>
  dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  dl > dt, dd {
    display: inline-block;
  }

  dt::after {
    content: ": ";
  }
</style>