Files
portal/components/lab/ServiceLinks.tsx
T
Tom Chien (IQ-AS) 1988c635fe
CI/CD (dev on branch, prod on tag) / build-and-deploy (push) Successful in 20m35s
upload
2026-11-18 14:26:36 +08:00

67 lines
2.6 KiB
TypeScript

import type { ReactNode } from "react";
import { siGitea, siHarbor } from "simple-icons";
import { BarChart3, ExternalLink } from "lucide-react";
import { BrandIcon } from "@/components/BrandIcon";
import { CredentialRows } from "@/components/CredentialRows";
import { labServices, type LabService } from "@/content/site";
const visuals: Record<LabService["id"], { icon: ReactNode; accent: string }> = {
"it-cost-prod": {
icon: <BarChart3 className="size-6 text-emerald-300" aria-hidden="true" />,
accent: "#6ee7b7",
},
harbor: {
icon: <BrandIcon icon={siHarbor} className="size-6" />,
accent: `#${siHarbor.hex}`,
},
gitea: {
icon: <BrandIcon icon={siGitea} className="size-6" />,
accent: `#${siGitea.hex}`,
},
};
export function ServiceLinks() {
return (
<ul className="grid gap-4 md:grid-cols-3">
{labServices.map((s) => {
const v = visuals[s.id];
return (
<li
key={s.id}
className="flex flex-col rounded-xl border border-white/10 bg-slate-900/70 p-5 shadow-lg shadow-black/20"
>
<div className="flex items-center gap-3">
<span
className="flex size-12 flex-none items-center justify-center rounded-lg border"
style={{ backgroundColor: `${v.accent}1f`, borderColor: `${v.accent}40` }}
>
{v.icon}
</span>
<div className="min-w-0">
<h4 className="font-semibold text-white">{s.name}</h4>
<p className="flex items-center gap-1.5 text-xs text-emerald-300">
<span className="pulse-ring size-1.5 rounded-full bg-emerald-400" />
{s.id}
</p>
</div>
</div>
<p className="mt-4 text-sm leading-6 text-slate-300">{s.description}</p>
<a
href={s.url}
target="_blank"
rel="noopener noreferrer"
className="mt-4 flex items-center justify-between gap-2 rounded-lg border border-sky-400/30 bg-sky-400/10 px-3 py-2 font-mono text-sm text-sky-200 transition-colors hover:bg-sky-400/20 focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
>
<span className="truncate">{s.host}</span>
<ExternalLink className="size-4 flex-none" aria-hidden="true" />
</a>
<div className="mt-5 border-t border-white/10 pt-4">
<CredentialRows user={s.user} password={s.password} />
</div>
</li>
);
})}
</ul>
);
}