You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
324 B
TypeScript

import { ComponentChildren, h } from "preact";
export const Validated = (p: {
errors?: string[];
children?: ComponentChildren;
}) => {
const errorText = h("div", { class: "error-message" }, ...(p.errors ?? []));
return h(
"div",
{ class: `validated ${p.errors ? "error" : ""}` },
p.children,
errorText,
);
};