feat(ui): port dashboard components to react
This commit is contained in:
parent
a71d66b1b8
commit
73abcc1b69
33 changed files with 1304 additions and 182 deletions
50
src/lib/ui/components/ServiceRow.tsx
Normal file
50
src/lib/ui/components/ServiceRow.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type { UiServiceRow } from "../types";
|
||||
import { IconGlyph } from "./IconGlyph";
|
||||
import { StatusBadge } from "./StatusBadge";
|
||||
|
||||
export interface ServiceRowProps {
|
||||
service: UiServiceRow;
|
||||
}
|
||||
|
||||
export function ServiceRow({ service }: ServiceRowProps) {
|
||||
const target = service.link?.external ? "_blank" : undefined;
|
||||
const rel = service.link?.external ? "noreferrer" : undefined;
|
||||
const content = (
|
||||
<>
|
||||
<IconGlyph name={service.icon} />
|
||||
<div className="service-row__main">
|
||||
<h3>{service.label}</h3>
|
||||
<p>{service.description}</p>
|
||||
</div>
|
||||
{service.detail ? (
|
||||
<StatusBadge label={service.detail} severity={service.severity} />
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
|
||||
if (service.link) {
|
||||
return (
|
||||
<a
|
||||
className="service-row"
|
||||
data-severity={service.severity}
|
||||
data-model-id={service.id}
|
||||
href={service.link.href}
|
||||
target={target}
|
||||
rel={rel}
|
||||
aria-label={service.link.label}
|
||||
>
|
||||
{content}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<article
|
||||
className="service-row"
|
||||
data-severity={service.severity}
|
||||
data-model-id={service.id}
|
||||
>
|
||||
{content}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue