Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 67x 67x 67x | import { Button, Form } from "react-bootstrap";
import { useForm } from "react-hook-form";
function DokkuUsersListHeaderForm({
initialContents = "",
submitAction,
buttonLabel = "Save Header",
}) {
// `values` (rather than defaultValues) keeps the textarea in sync with the
// header as it is loaded from the backend after the form first renders.
// Stryker disable all
const { register, handleSubmit } = useForm({
values: { dokkuUsersListHeader: initialContents },
});
// Stryker restore all
const testIdPrefix = "DokkuUsersListHeaderForm";
return (
<Form onSubmit={handleSubmit(submitAction)}>
<Form.Group className="mb-3">
<Form.Label htmlFor="dokkuUsersListHeader">
Extra lines at the start of dokku_users_list.csv
</Form.Label>
<Form.Control
as="textarea"
rows={6}
data-testid={testIdPrefix + "-dokkuUsersListHeader"}
id="dokkuUsersListHeader"
placeholder={"username,dokku-00\nusername,dokku-01"}
{...register("dokkuUsersListHeader")}
/>
</Form.Group>
<Button type="submit" data-testid={testIdPrefix + "-submit"}>
{buttonLabel}
</Button>
</Form>
);
}
export default DokkuUsersListHeaderForm;
|