import { ResolvedProperty } from "../../types"; import { IconButton, InfoIcon, Tooltip, Typography } from "@firecms/ui"; /** * Component in charge of rendering the description of a field * as well as the error message if any. */ export function FieldHelperText({ error, showError, property, includeDescription = true, disabled }: { error?: string, showError: boolean, property: ResolvedProperty, includeDescription?: boolean, disabled?: boolean, } ) { const hasDescription = property.description || property.longDescription; if (!(showError && error) && (!includeDescription || !hasDescription)) return null; if (showError && error) { return {error} } const disabledTooltip: string | undefined = typeof property.disabled === "object" ? property.disabled.disabledMessage : undefined; return
{disabledTooltip || property.description} {property.longDescription && }
}