404 hosts polish

This commit is contained in:
Jamie Curnow
2025-09-24 19:45:00 +10:00
parent 18537b9288
commit da68fe29ac
10 changed files with 95 additions and 25 deletions

View File

@@ -4,14 +4,32 @@ interface Props {
domains: string[];
createdOn?: string;
}
const DomainLink = ({ domain }: { domain: string }) => {
// when domain contains a wildcard, make the link go nowhere.
let onClick: ((e: React.MouseEvent) => void) | undefined;
if (domain.includes("*")) {
onClick = (e: React.MouseEvent) => e.preventDefault();
}
return (
<a
key={domain}
href={`http://${domain}`}
target="_blank"
onClick={onClick}
className="badge bg-yellow-lt domain-name me-2"
>
{domain}
</a>
);
};
export function DomainsFormatter({ domains, createdOn }: Props) {
return (
<div className="flex-fill">
<div className="font-weight-medium">
{domains.map((domain: string) => (
<a key={domain} href={`http://${domain}`} className="badge bg-yellow-lt domain-name">
{domain}
</a>
<DomainLink key={domain} domain={domain} />
))}
</div>
{createdOn ? (