Skip to content

Commit bb98a4a

Browse files
committed
3172: Added to activation code form
1 parent 77d13aa commit bb98a4a

File tree

2 files changed

+49
-47
lines changed

2 files changed

+49
-47
lines changed

src/components/activation-code/activation-code-create.jsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,14 @@ function ActivationCodeCreate() {
6969
};
7070

7171
return (
72-
<div className="p-3">
73-
<ActivationCodeForm
74-
activationCode={formStateObject}
75-
headerText={headerText}
76-
handleInput={handleInput}
77-
handleSubmit={handleSubmit}
78-
isLoading={isSaving}
79-
loadingMessage={t("loading-messages.saving-activation-code")}
80-
/>
81-
</div>
72+
<ActivationCodeForm
73+
activationCode={formStateObject}
74+
headerText={headerText}
75+
handleInput={handleInput}
76+
handleSubmit={handleSubmit}
77+
isLoading={isSaving}
78+
loadingMessage={t("loading-messages.saving-activation-code")}
79+
/>
8280
);
8381
}
8482

src/components/activation-code/activation-code-form.jsx

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { React } from "react";
22
import { useNavigate } from "react-router-dom";
3-
import { Button } from "react-bootstrap";
3+
import { Button, Col, Row } from "react-bootstrap";
44
import { useTranslation } from "react-i18next";
55
import PropTypes from "prop-types";
66
import Form from "react-bootstrap/Form";
77
import LoadingComponent from "../util/loading-component/loading-component";
88
import ContentBody from "../util/content-body/content-body";
9-
import ContentFooter from "../util/content-footer/content-footer";
109
import FormInput from "../util/forms/form-input";
1110
import RadioButtons from "../util/forms/radio-buttons";
11+
import StickyFooter from "../util/sticky-footer";
1212

1313
/**
1414
* The user form component.
@@ -17,6 +17,7 @@ import RadioButtons from "../util/forms/radio-buttons";
1717
* @param {object} props.activationCode The activationCode object to modify in the form.
1818
* @param {Function} props.handleInput Handles form input.
1919
* @param {Function} props.handleSubmit Handles form submit.
20+
* @param {Function} props.handleSaveNoClose Handles form submit without close.
2021
* @param {string} props.headerText Headline text.
2122
* @param {boolean} props.isLoading Indicator of whether the form is loading
2223
* @param {string} props.loadingMessage The loading message for the spinner
@@ -48,44 +49,48 @@ function ActivationCodeForm({
4849
<>
4950
<LoadingComponent isLoading={isLoading} loadingMessage={loadingMessage} />
5051
<Form>
51-
<h1 id="h1UserDisplayName">{headerText}</h1>
52-
<ContentBody>
53-
<div className="mb-2">
54-
<FormInput
55-
title="display-name"
56-
type="text"
57-
label={t("display-name-label")}
58-
placeholder={t("display-name-placeholder")}
59-
value={activationCode.displayName}
60-
onChange={handleInput}
61-
name="displayName"
62-
required
63-
/>
64-
</div>
65-
<div className="mb-2">
66-
<RadioButtons
67-
radioGroupName="role"
68-
handleChange={handleInput}
69-
options={roles}
70-
label={t("role-label")}
71-
selected={activationCode.role}
72-
/>
73-
<div>
74-
<small>{t("role-external-user-helptext")}</small>
75-
</div>
76-
<div>
77-
<small>{t("role-external-user-admin-helptext")}</small>
78-
</div>
79-
</div>
80-
</ContentBody>
81-
<ContentFooter>
52+
<Row className="m-3">
53+
<h1 id="h1UserDisplayName">{headerText}</h1>
54+
<Col>
55+
<ContentBody>
56+
<div className="mb-2">
57+
<FormInput
58+
title="display-name"
59+
type="text"
60+
label={t("display-name-label")}
61+
placeholder={t("display-name-placeholder")}
62+
value={activationCode.displayName}
63+
onChange={handleInput}
64+
name="displayName"
65+
required
66+
/>
67+
</div>
68+
<div className="mb-2">
69+
<RadioButtons
70+
radioGroupName="role"
71+
handleChange={handleInput}
72+
options={roles}
73+
label={t("role-label")}
74+
selected={activationCode.role}
75+
/>
76+
<div>
77+
<small>{t("role-external-user-helptext")}</small>
78+
</div>
79+
<div>
80+
<small>{t("role-external-user-admin-helptext")}</small>
81+
</div>
82+
</div>
83+
</ContentBody>
84+
</Col>
85+
</Row>
86+
87+
<StickyFooter>
8288
<Button
8389
variant="secondary"
8490
type="button"
8591
id="cancel_user"
8692
onClick={() => navigate("/activation/list/")}
8793
className="margin-right-button"
88-
size="lg"
8994
>
9095
{t("cancel-button")}
9196
</Button>
@@ -94,12 +99,10 @@ function ActivationCodeForm({
9499
type="button"
95100
onClick={handleSubmit}
96101
id="save_user"
97-
size="lg"
98-
className="col"
99102
>
100103
{t("save-button")}
101104
</Button>
102-
</ContentFooter>
105+
</StickyFooter>
103106
</Form>
104107
</>
105108
);
@@ -112,6 +115,7 @@ ActivationCodeForm.propTypes = {
112115
}).isRequired,
113116
handleInput: PropTypes.func.isRequired,
114117
handleSubmit: PropTypes.func.isRequired,
118+
handleSaveNoClose: PropTypes.func.isRequired,
115119
headerText: PropTypes.string.isRequired,
116120
isLoading: PropTypes.bool,
117121
loadingMessage: PropTypes.string,

0 commit comments

Comments
 (0)