Files
ui/pkg/canvas/src/SourceRef.tsx
zeekayandHanzo Dev 57f9435929 Keep every package in one directory
The workspace declared pkg/* and pkgs/* both, so one repo had two names
for one concept and a package's home was a coin toss. The shared build
tooling already lived in pkg/ui/scripts and pkgs reached back into it
two levels up; now it is a sibling. hanzo.yml gates on pkg/ui, so the
published library stays where CI already looks and the rest joins it.

The publish glob follows: one root, one pattern, nothing invisible to it.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-08 23:50:28 -07:00

52 lines
1.4 KiB
TypeScript

"use client"
/**
* A compact source reference — the repo (`owner/name` + branch), image
* (`repository:tag`), template, database engine, or managed origin a service
* ships from, with a matching glyph. Monospace ref for scannability; the text
* uses a neutral design token, the decorative glyph a muted neutral hue.
*/
import { Text, XStack } from "@hanzo/gui"
import { sourceGlyph } from "./glyphs"
import type { ServiceSource } from "./types"
const MONO = "ui-monospace, SFMono-Regular, Menlo, monospace"
export interface SourceRefProps {
source: ServiceSource
size?: "sm" | "md"
}
export function SourceRef({ source, size = "md" }: SourceRefProps) {
const Glyph = sourceGlyph(source.kind)
const fs = size === "sm" ? "$1" : "$2"
const glyphSize = size === "sm" ? 12 : 13
return (
<XStack items="center" gap="$1.5" minW={0}>
<span style={{ display: "inline-flex", color: "#8b949e", flexShrink: 0 }}>
<Glyph size={glyphSize} />
</span>
<Text
fontSize={fs}
color="$color10"
numberOfLines={1}
style={{ fontFamily: MONO }}
minW={0}
>
{source.ref}
</Text>
{source.branch ? (
<Text
fontSize={fs}
color="$color9"
numberOfLines={1}
style={{ fontFamily: MONO }}
>
{source.branch}
</Text>
) : null}
</XStack>
)
}