admin: nice divider between error and helper text

Massimo Melina committed May 6, 2022 at 10:38 UTC 3fd7650458b502d7bfb0057260f921025ce790df
1 file changed +3 -2
admin/src/Form.ts
+3 -2
@@ -14,6 +14,7 @@ import {
14 import {
15 Box, BoxProps, Button,
16 Checkbox,
17 + Divider,
18 FormControl,
19 FormControlLabel, FormGroup, FormHelperText,
20 FormLabel,
@@ -117,8 +118,8 @@ export function Form<Values extends Dict>({ fields, values, set, defaults, save,
118 set(v, k)
119 },
120 }
120 - if (error)
121 - field.helperText = field.helperText ? h(Fragment, {}, error, h('br'), field.helperText)
121 + if (error) // special rendering when we have both error and helperText. "hr" would be nice but issues a warning because contained in a <p>
122 + field.helperText = field.helperText ? h(Fragment, {}, h('span', { style: { borderBottom: '1px solid' } }, error), h('br'), field.helperText)
123 : error
124 if (field.label === undefined)
125 field.label = labelFromKey(k)