summaryrefslogtreecommitdiff
path: root/src/components/Commit.astro
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/Commit.astro')
-rw-r--r--src/components/Commit.astro49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/components/Commit.astro b/src/components/Commit.astro
new file mode 100644
index 0000000..3ee284a
--- /dev/null
+++ b/src/components/Commit.astro
@@ -0,0 +1,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>