git stack source badge with forge-aware icons and commit hash

This commit is contained in:
jarek committed 2026-07-31 10:10:56 +02:00
1 parent 9bc4eaa47b
commit c18ee21a66
9 files changed
+280 -76

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import { Github, Gitlab } from 'lucide-svelte';
import type { Component } from 'svelte';
import GitGenericIcon from '$lib/components/icons/GitGenericIcon.svelte';
/**
* Pick a forge icon from a repo URL: GitHub and GitLab get their own mark,
* everything else gets the generic Git logo (mdi-git, not lucide's GitBranch
* which reads as a branch).
*/
export function forgeIcon(url: string | null | undefined): Component {
const u = (url || '').toLowerCase();
if (u.includes('github.com')) return Github as unknown as Component;
if (u.includes('gitlab.')) return Gitlab as unknown as Component;
return GitGenericIcon as unknown as Component;
}