swarm-ui: say when the hive or permission list failed to load, and name the permissions group
This commit is contained in:
parent
8c67ac01fe
commit
46a6fc36d8
1 changed files with 25 additions and 8 deletions
|
|
@ -4,23 +4,36 @@
|
|||
// don't each reinvent the label/spacing chrome; a bare labelled `<div>`
|
||||
// wrapper has no independent identity worth a `/components` entry of
|
||||
// its own.
|
||||
//
|
||||
// A control a `<label for>` can name (input, select, textarea) passes
|
||||
// `htmlFor`. A group of controls (a checkbox set) has no single element to
|
||||
// point at: it passes `labelId` instead and puts `role="group"` with
|
||||
// `aria-labelledby` on the group.
|
||||
import type { ComponentChildren } from "preact";
|
||||
import "./FormField.css";
|
||||
|
||||
export function FormField({
|
||||
label,
|
||||
htmlFor,
|
||||
labelId,
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
htmlFor: string;
|
||||
htmlFor?: string;
|
||||
labelId?: string;
|
||||
children: ComponentChildren;
|
||||
}) {
|
||||
return (
|
||||
<div class="ui-form-field">
|
||||
<label class="ui-form-field-label" for={htmlFor}>
|
||||
{label}
|
||||
</label>
|
||||
{htmlFor !== undefined ? (
|
||||
<label class="ui-form-field-label" for={htmlFor}>
|
||||
{label}
|
||||
</label>
|
||||
) : (
|
||||
<span class="ui-form-field-label" id={labelId}>
|
||||
{label}
|
||||
</span>
|
||||
)}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue