Skip to content

Commit 7cd19df

Browse files
committed
Made improvements to SASS files for new Bootstrap version. Updated deps.
1 parent bc391e5 commit 7cd19df

File tree

11 files changed

+368
-319
lines changed

11 files changed

+368
-319
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [v3.1.1](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.1.0...v3.1.1) (2022-09-08)
4+
5+
### Features
6+
7+
* Made improvements to SASS files for new Bootstrap version.
8+
* Updated dependencies.
9+
310
## [v3.1.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.0.3...v3.1.0) (2022-09-05)
411

512
### Features

assets/src/Admin/CreateUserModal.jsx

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,29 @@ class CreateUserModal extends React.Component {
3131

3232
this.setState({wasValidated: true, isLoading: true});
3333

34-
if (e.target.checkValidity() && (!this.state.setPassword || (this.state.password1 === this.state.password2))) {
35-
this.props.onCreate({
36-
firstName: this.state.firstName,
37-
lastName: this.state.lastName,
38-
email: this.state.email,
39-
role: this.state.role,
40-
setPassword: this.state.setPassword,
41-
password: this.state.password1
42-
}, () => this.handleClose(() => {}), () => this.setState({isLoading: false}));
34+
if (e.target.checkValidity() && (!this.state.setPassword || (this.state.password1 === this.state.password2 && this.state.password1.length > 5))) {
35+
this.props.onCreate(
36+
{
37+
firstName: this.state.firstName,
38+
lastName: this.state.lastName,
39+
email: this.state.email,
40+
role: this.state.role,
41+
setPassword: this.state.setPassword,
42+
password: this.state.password1
43+
},
44+
this.handleClose,
45+
() => this.setState({isLoading: false})
46+
);
4347
} else {
4448
this.setState({isLoading: false});
4549
}
4650
}
4751

4852
handleClose(onClose) {
53+
if (!onClose) {
54+
onClose = _.noop;
55+
}
56+
4957
this.setState({
5058
firstName: '',
5159
lastName: '',
@@ -150,62 +158,60 @@ class CreateUserModal extends React.Component {
150158

151159
<Collapse in={this.state.setPassword}>
152160
<div className="mt-3 mb-2">
153-
{
154-
this.state.setPassword ?
155-
<>
156-
<Form.Group className="mb-3" controlId="password1">
157-
<Form.Label>Password</Form.Label>
158-
<Form.Control
159-
type="password"
160-
placeholder="Enter Password"
161-
onChange={(e) => this.setState({password1: e.target.value})}
162-
className={(this.state.password1 !== this.state.password2 && this.state.password1.length > 5 && this.state.password2.length > 5)
163-
? 'is-invalid'
164-
: null}
165-
required
166-
disabled={this.state.isLoading}
167-
/>
168-
<Form.Control.Feedback type="invalid" className={(this.state.password1 !== this.state.password2) ? 'd-none' : null}>Password is
169-
required.
170-
</Form.Control.Feedback>
171-
</Form.Group>
172-
173-
<Form.Group controlId="password2">
174-
<Form.Label>Verify Password</Form.Label>
175-
<Form.Control
176-
type="password"
177-
placeholder="Verify Password"
178-
onChange={(e) => this.setState({password2: e.target.value})}
179-
className={(this.state.password1 !== this.state.password2 && this.state.password1.length > 5 && this.state.password2.length > 5)
180-
? 'is-invalid'
181-
: null}
182-
required
183-
disabled={this.state.isLoading}
184-
/>
185-
{
186-
(this.state.password1 !== '') ?
187-
<Form.Control.Feedback type="invalid">
188-
{
189-
(this.state.password1 !== this.state.password2)
190-
? 'Passwords do not match.'
191-
: 'Must verify password.'
192-
}
193-
</Form.Control.Feedback>
194-
:
195-
null
196-
}
197-
</Form.Group>
198-
</>
199-
: null
200-
}
161+
<Form.Group className="mb-3" controlId="password1">
162+
<Form.Label>Password</Form.Label>
163+
<Form.Control
164+
type="password"
165+
placeholder="Enter Password"
166+
onChange={(e) => this.setState({password1: e.target.value})}
167+
className={
168+
(this.state.wasValidated && this.state.password1.length < 6)
169+
? 'is-invalid'
170+
: null
171+
}
172+
required
173+
disabled={this.state.isLoading || !this.state.setPassword}
174+
minLength="6"
175+
maxLength="72"
176+
/>
177+
<Form.Control.Feedback type="invalid" className={(!this.state.wasValidated || this.state.password1.length > 5) ? 'd-none' : null}>
178+
{
179+
(this.state.password1.length)
180+
? 'Password is too short.'
181+
: 'Password is required.'
182+
}
183+
</Form.Control.Feedback>
184+
</Form.Group>
185+
186+
<Form.Group controlId="password2">
187+
<Form.Label>Verify Password</Form.Label>
188+
<Form.Control
189+
type="password"
190+
placeholder="Verify Password"
191+
onChange={(e) => this.setState({password2: e.target.value})}
192+
className={
193+
(this.state.wasValidated && this.state.password1 !== this.state.password2 && this.state.password2.length)
194+
? 'is-invalid'
195+
: null
196+
}
197+
required
198+
disabled={this.state.isLoading || !this.state.setPassword}
199+
minLength="6"
200+
/>
201+
{
202+
(this.state.wasValidated && this.state.password1.length && this.state.password2.length)
203+
? <Form.Control.Feedback type="invalid">Passwords do not match.</Form.Control.Feedback>
204+
: null
205+
}
206+
</Form.Group>
201207
</div>
202208
</Collapse>
203209
</Modal.Body>
204210

205211
<Modal.Footer className="justify-content-between">
206212
<Button variant="secondary" onClick={() => this.handleClose(this.props.onClose)} disabled={this.state.isLoading}>Cancel</Button>
207213
<Button variant="primary" type="submit" disabled={this.state.isLoading}>
208-
{this.state.isLoading ? 'Loading...': 'Create'}
214+
{this.state.isLoading ? 'Loading...' : 'Create'}
209215
</Button>
210216
</Modal.Footer>
211217
</Form>

assets/styles/admin/admin.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@import "~bootstrap/scss/functions";
2-
// @import "functions";
32

43
@import "bootstrap-variable-overrides";
54
@import "~bootstrap/scss/variables";
65

6+
@import "~bootstrap/scss/maps";
7+
78
@import "~bootstrap/scss/mixins";
8-
// @import "mixins";
99

1010
@import "../common/bootstrap";
1111

assets/styles/admin/bootstrap-variable-overrides.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ $enable-important-utilities: true;
335335
// Prefix for :root CSS variables
336336

337337
$variable-prefix: bs-;
338+
$prefix: $variable-prefix;
338339

339340
// Gradient
340341
//

assets/styles/common/_bootstrap.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
@import "~bootstrap/scss/offcanvas";
3131
@import "~bootstrap/scss/placeholders";
3232
@import "~bootstrap/scss/utilities";
33-
@import "~bootstrap/scss/functions";
33+
//@import "~bootstrap/scss/functions";
3434
@import "~bootstrap/scss/helpers";
3535
@import "~bootstrap/scss/utilities/api";

assets/styles/common/_reboot.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ iframe {
88
border: 0;
99
}
1010

11-
figcaption,
12-
figure,
13-
main {
11+
figcaption, figure, main {
1412
display: block;
1513
}
1614

assets/styles/common/common.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ select.prevent-validation:valid, select.prevent-validation.is-valid{
2222
}
2323

2424
& ~ .form-check-label {
25-
color: var(--#{$variable-prefix}body-color) !important;
25+
color: var(--#{$prefix}body-color) !important;
26+
}
27+
}
28+
29+
// .is-invalid class enforcements
30+
.was-validated .form-control.is-invalid {
31+
border-color: $form-feedback-invalid-color !important;
32+
33+
background-image: escape-svg($form-feedback-icon-invalid) !important;
34+
35+
&:focus {
36+
box-shadow: 0 0 0 0.25rem rgba($form-feedback-invalid-color, .25) !important;
2637
}
2738
}

assets/styles/marketing/bootstrap-variable-overrides.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ $enable-important-utilities: true;
335335
// Prefix for :root CSS variables
336336

337337
$variable-prefix: bs-;
338+
$prefix: $variable-prefix;
338339

339340
// Gradient
340341
//

assets/styles/marketing/marketing.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
@import "~bootstrap/scss/functions";
2-
//@import "functions";
32

43
@import "bootstrap-variable-overrides";
54
@import "~bootstrap/scss/variables";
65

6+
@import "~bootstrap/scss/maps";
7+
78
@import "~bootstrap/scss/mixins";
8-
//@import "mixins";
99

1010
@import "../common/bootstrap";
1111

0 commit comments

Comments
 (0)