Skip to content

Commit 28b9663

Browse files
authored
Merge branch 'develop' into fix-projectoptions-closing
2 parents 039c92e + 44d967d commit 28b9663

File tree

6 files changed

+89
-62
lines changed

6 files changed

+89
-62
lines changed

client/modules/IDE/components/QuickAddList/QuickAddList.jsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,21 @@ const Item = ({ isAdded, onSelect, name, url }) => {
1010
const buttonLabel = isAdded
1111
? t('QuickAddList.ButtonRemoveARIA')
1212
: t('QuickAddList.ButtonAddToCollectionARIA');
13+
14+
const handleKeyDown = (event) => {
15+
if (event.key === 'Enter' || event.key === ' ') {
16+
onSelect(event);
17+
}
18+
};
19+
1320
return (
14-
<li className="quick-add__item" onClick={onSelect}> { /* eslint-disable-line */ }
21+
<div
22+
role="button"
23+
className="quick-add__item"
24+
onClick={onSelect}
25+
onKeyDown={handleKeyDown}
26+
tabIndex={0}
27+
>
1528
<button
1629
className="quick-add__item-toggle"
1730
onClick={onSelect}
@@ -28,7 +41,7 @@ const Item = ({ isAdded, onSelect, name, url }) => {
2841
>
2942
{t('QuickAddList.View')}
3043
</Link>
31-
</li>
44+
</div>
3245
);
3346
};
3447

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
1-
import { bindActionCreators } from 'redux';
2-
import { connect } from 'react-redux';
1+
import React from 'react';
2+
import { useDispatch, useSelector } from 'react-redux';
33
import i18next from 'i18next';
44
import * as SortingActions from '../../actions/sorting';
55

66
import Searchbar from './Searchbar';
77

88
const scope = 'collection';
99

10-
function mapStateToProps(state) {
11-
return {
12-
searchLabel: i18next.t('Searchbar.SearchCollection'),
13-
searchTerm: state.search[`${scope}SearchTerm`]
10+
const SearchbarContainer = () => {
11+
const dispatch = useDispatch();
12+
const searchLabel = i18next.t('Searchbar.SearchCollection');
13+
const searchTerm = useSelector((state) => state.search[`${scope}SearchTerm`]);
14+
15+
const setSearchTerm = (term) => {
16+
dispatch(SortingActions.setSearchTerm(scope, term));
1417
};
15-
}
1618

17-
function mapDispatchToProps(dispatch) {
18-
const actions = {
19-
setSearchTerm: (term) => SortingActions.setSearchTerm(scope, term),
20-
resetSearchTerm: () => SortingActions.resetSearchTerm(scope)
19+
const resetSearchTerm = () => {
20+
dispatch(SortingActions.resetSearchTerm(scope));
2121
};
22-
return bindActionCreators(Object.assign({}, actions), dispatch);
23-
}
2422

25-
export default connect(mapStateToProps, mapDispatchToProps)(Searchbar);
23+
return (
24+
<Searchbar
25+
searchLabel={searchLabel}
26+
searchTerm={searchTerm}
27+
setSearchTerm={setSearchTerm}
28+
resetSearchTerm={resetSearchTerm}
29+
/>
30+
);
31+
};
32+
33+
export default SearchbarContainer;

client/modules/IDE/components/Searchbar/Searchbar.jsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import React, { useState, useCallback, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import { throttle } from 'lodash';
4-
import { withTranslation } from 'react-i18next';
4+
import { useTranslation } from 'react-i18next';
55
import i18next from 'i18next';
66
import SearchIcon from '../../../../images/magnifyingglass.svg';
77

88
const Searchbar = ({
99
searchTerm,
1010
setSearchTerm,
1111
resetSearchTerm,
12-
searchLabel,
13-
t
12+
searchLabel
1413
}) => {
14+
const { t } = useTranslation();
1515
const [searchValue, setSearchValue] = useState(searchTerm);
1616

1717
const throttledSearchChange = useCallback(
1818
throttle((value) => {
1919
setSearchTerm(value.trim());
2020
}, 500),
21-
[]
21+
[setSearchTerm]
2222
);
2323

2424
const handleResetSearch = () => {
@@ -65,12 +65,11 @@ Searchbar.propTypes = {
6565
searchTerm: PropTypes.string.isRequired,
6666
setSearchTerm: PropTypes.func.isRequired,
6767
resetSearchTerm: PropTypes.func.isRequired,
68-
searchLabel: PropTypes.string,
69-
t: PropTypes.func.isRequired
68+
searchLabel: PropTypes.string
7069
};
7170

7271
Searchbar.defaultProps = {
7372
searchLabel: i18next.t('Searchbar.SearchSketch')
7473
};
7574

76-
export default withTranslation()(Searchbar);
75+
export default Searchbar;
Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
1-
import { bindActionCreators } from 'redux';
2-
import { connect } from 'react-redux';
1+
import React from 'react';
2+
import { useDispatch, useSelector } from 'react-redux';
33
import i18next from 'i18next';
44
import * as SortingActions from '../../actions/sorting';
5-
65
import Searchbar from './Searchbar';
76

87
const scope = 'sketch';
98

10-
function mapStateToProps(state) {
11-
return {
12-
searchLabel: i18next.t('Searchbar.SearchSketch'),
13-
searchTerm: state.search[`${scope}SearchTerm`]
9+
const SearchbarContainer = () => {
10+
const dispatch = useDispatch();
11+
const searchLabel = i18next.t('Searchbar.SearchSketch');
12+
const searchTerm = useSelector((state) => state.search[`${scope}SearchTerm`]);
13+
14+
const setSearchTerm = (term) => {
15+
dispatch(SortingActions.setSearchTerm(scope, term));
1416
};
15-
}
1617

17-
function mapDispatchToProps(dispatch) {
18-
const actions = {
19-
setSearchTerm: (term) => SortingActions.setSearchTerm(scope, term),
20-
resetSearchTerm: () => SortingActions.resetSearchTerm(scope)
18+
const resetSearchTerm = () => {
19+
dispatch(SortingActions.resetSearchTerm(scope));
2120
};
22-
return bindActionCreators(Object.assign({}, actions), dispatch);
23-
}
2421

25-
export default connect(mapStateToProps, mapDispatchToProps)(Searchbar);
22+
return (
23+
<Searchbar
24+
searchLabel={searchLabel}
25+
searchTerm={searchTerm}
26+
setSearchTerm={setSearchTerm}
27+
resetSearchTerm={resetSearchTerm}
28+
/>
29+
);
30+
};
31+
32+
export default SearchbarContainer;

client/modules/User/components/LoginForm.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ function LoginForm() {
5757
{t('LoginForm.Password')}
5858
</label>
5959
<div className="form__field__password">
60+
<input
61+
className="form__input"
62+
aria-label={t('LoginForm.PasswordARIA')}
63+
type={showPassword ? 'text' : 'password'}
64+
id="password"
65+
autoComplete="current-password"
66+
{...field.input}
67+
/>
6068
<button
6169
className="form__eye__icon"
6270
type="button"
@@ -69,14 +77,6 @@ function LoginForm() {
6977
<AiOutlineEye />
7078
)}
7179
</button>
72-
<input
73-
className="form__input"
74-
aria-label={t('LoginForm.PasswordARIA')}
75-
type={showPassword ? 'text' : 'password'}
76-
id="password"
77-
autoComplete="current-password"
78-
{...field.input}
79-
/>
8080
</div>
8181
{field.meta.touched && field.meta.error && (
8282
<span className="form-error" aria-live="polite">

client/modules/User/components/SignupForm.jsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ function SignupForm() {
113113
{t('SignupForm.Password')}
114114
</label>
115115
<div className="form__field__password">
116+
<input
117+
className="form__input"
118+
aria-label={t('SignupForm.PasswordARIA')}
119+
type={showPassword ? 'text' : 'password'}
120+
id="password"
121+
autoComplete="new-password"
122+
{...field.input}
123+
/>
116124
<button
117125
className="form__eye__icon"
118126
type="button"
@@ -125,14 +133,6 @@ function SignupForm() {
125133
<AiOutlineEye />
126134
)}
127135
</button>
128-
<input
129-
className="form__input"
130-
aria-label={t('SignupForm.PasswordARIA')}
131-
type={showPassword ? 'text' : 'password'}
132-
id="password"
133-
autoComplete="new-password"
134-
{...field.input}
135-
/>
136136
</div>
137137
{field.meta.touched && field.meta.error && (
138138
<span className="form-error" aria-live="polite">
@@ -149,6 +149,14 @@ function SignupForm() {
149149
{t('SignupForm.ConfirmPassword')}
150150
</label>
151151
<div className="form__field__password">
152+
<input
153+
className="form__input"
154+
type={showConfirmPassword ? 'text' : 'password'}
155+
aria-label={t('SignupForm.ConfirmPasswordARIA')}
156+
id="confirmPassword" // Match the id with htmlFor
157+
autoComplete="new-password"
158+
{...field.input}
159+
/>
152160
<button
153161
className="form__eye__icon"
154162
type="button"
@@ -161,14 +169,6 @@ function SignupForm() {
161169
<AiOutlineEye />
162170
)}
163171
</button>
164-
<input
165-
className="form__input"
166-
type={showConfirmPassword ? 'text' : 'password'}
167-
aria-label={t('SignupForm.ConfirmPasswordARIA')}
168-
id="confirmPassword" // Match the id with htmlFor
169-
autoComplete="new-password"
170-
{...field.input}
171-
/>
172172
</div>
173173
{field.meta.touched && field.meta.error && (
174174
<span className="form-error" aria-live="polite">

0 commit comments

Comments
 (0)