diff --git a/src/components/forms/FormPair.tsx b/src/components/forms/FormPair.tsx index a2ffa5c..72ed94d 100644 --- a/src/components/forms/FormPair.tsx +++ b/src/components/forms/FormPair.tsx @@ -22,23 +22,16 @@ export function FormPair({id, label, input, validity, bluelibClassNames, customC id = UUID.v4() } - let validityClass - // If the input is valid - if(validity === true) { + let validityClass = "" + if(validity === "running") { + validityClass = "color-yellow" + } + else if(validity === "ok") { validityClass = "color-lime" } - // If the input is invalid - else if(validity === false) { + else if(validity === "error") { validityClass = "color-red" } - // If the input has no validity - else if(validity === null) { - validityClass = "" - } - // If no validity has been passed - else { - validityClass = "" - } label = React.cloneElement(label, { htmlFor: id, diff --git a/src/types.ts b/src/types.ts index 58cdcb9..4fb31ad 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,4 +21,4 @@ export interface BluelibHTMLProps extends BluelibPr export type InputValue = readonly string[] | string | number | undefined -export type Validity = boolean | null +export type Validity = null | "running" | "ok" | "error"