diff options
author | 2021-07-02 19:49:55 -0600 | |
---|---|---|
committer | 2021-07-03 07:19:55 +0530 | |
commit | 33123c354b79f7951423dd75097b11e7eb075f99 (patch) | |
tree | 29f6e857f02d0e0fc67d89a657a54a865ed5538a /src/components/settings/SettingsLayout.js | |
parent | Minor refactoring to move all runtime configs from 'config.js' into 'environm... (diff) | |
download | ferdium-app-33123c354b79f7951423dd75097b11e7eb075f99.tar.gz ferdium-app-33123c354b79f7951423dd75097b11e7eb075f99.tar.zst ferdium-app-33123c354b79f7951423dd75097b11e7eb075f99.zip |
Upgrade various dependencies to latest part 2 (#1557)
* Upgrade various dependencies to latest, remove unnecessary electron-hunspell
- upgrade eslint and friends to latest
- remove deprecated 'node-sass' in favor of 'sass'
- disable new rules from 'eslint-config-airbnb' that are conflicting with current code style
- add workspace config for 'vscode' that silences 'experimentalDecorator' warning and forces 'prettier' to single quote
* Run yarn lint to autofix with new ruleset and worked down lint issues to zero
Diffstat (limited to 'src/components/settings/SettingsLayout.js')
-rw-r--r-- | src/components/settings/SettingsLayout.js | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/components/settings/SettingsLayout.js b/src/components/settings/SettingsLayout.js index 72ba7b2e3..5b3b754fa 100644 --- a/src/components/settings/SettingsLayout.js +++ b/src/components/settings/SettingsLayout.js | |||
@@ -1,38 +1,55 @@ | |||
1 | import React, { Component } from 'react'; | 1 | import React, { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import { observer } from 'mobx-react'; | 3 | import { observer } from 'mobx-react'; |
4 | import { defineMessages, intlShape } from 'react-intl'; | ||
4 | 5 | ||
5 | import ErrorBoundary from '../util/ErrorBoundary'; | 6 | import ErrorBoundary from '../util/ErrorBoundary'; |
6 | import { oneOrManyChildElements } from '../../prop-types'; | 7 | import { oneOrManyChildElements } from '../../prop-types'; |
7 | import Appear from '../ui/effects/Appear'; | 8 | import Appear from '../ui/effects/Appear'; |
8 | 9 | ||
9 | export default @observer class SettingsLayout extends Component { | 10 | const messages = defineMessages({ |
11 | closeSettings: { | ||
12 | id: 'settings.app.closeSettings', | ||
13 | defaultMessage: '!!!Close settings', | ||
14 | }, | ||
15 | }); | ||
16 | |||
17 | export default | ||
18 | @observer | ||
19 | class SettingsLayout extends Component { | ||
10 | static propTypes = { | 20 | static propTypes = { |
11 | navigation: PropTypes.element.isRequired, | 21 | navigation: PropTypes.element.isRequired, |
12 | children: oneOrManyChildElements.isRequired, | 22 | children: oneOrManyChildElements.isRequired, |
13 | closeSettings: PropTypes.func.isRequired, | 23 | closeSettings: PropTypes.func.isRequired, |
14 | }; | 24 | }; |
15 | 25 | ||
16 | componentWillMount() { | 26 | static contextTypes = { |
27 | intl: intlShape, | ||
28 | }; | ||
29 | |||
30 | componentDidMount() { | ||
17 | document.addEventListener('keydown', this.handleKeyDown.bind(this), false); | 31 | document.addEventListener('keydown', this.handleKeyDown.bind(this), false); |
18 | } | 32 | } |
19 | 33 | ||
20 | componentWillUnmount() { | 34 | componentWillUnmount() { |
21 | document.removeEventListener('keydown', this.handleKeyDown.bind(this), false); | 35 | document.removeEventListener( |
36 | 'keydown', | ||
37 | this.handleKeyDown.bind(this), | ||
38 | false, | ||
39 | ); | ||
22 | } | 40 | } |
23 | 41 | ||
24 | handleKeyDown(e) { | 42 | handleKeyDown(e) { |
25 | if (e.keyCode === 27) { // escape key | 43 | if (e.keyCode === 27) { |
44 | // escape key | ||
26 | this.props.closeSettings(); | 45 | this.props.closeSettings(); |
27 | } | 46 | } |
28 | } | 47 | } |
29 | 48 | ||
30 | render() { | 49 | render() { |
31 | const { | 50 | const { navigation, children, closeSettings } = this.props; |
32 | navigation, | 51 | |
33 | children, | 52 | const { intl } = this.context; |
34 | closeSettings, | ||
35 | } = this.props; | ||
36 | 53 | ||
37 | return ( | 54 | return ( |
38 | <Appear transitionName="fadeIn-fast"> | 55 | <Appear transitionName="fadeIn-fast"> |
@@ -42,6 +59,7 @@ export default @observer class SettingsLayout extends Component { | |||
42 | type="button" | 59 | type="button" |
43 | className="settings-wrapper__action" | 60 | className="settings-wrapper__action" |
44 | onClick={closeSettings} | 61 | onClick={closeSettings} |
62 | aria-label={intl.formatMessage(messages.closeSettings)} | ||
45 | /> | 63 | /> |
46 | <div className="settings franz-form"> | 64 | <div className="settings franz-form"> |
47 | {navigation} | 65 | {navigation} |
@@ -50,6 +68,7 @@ export default @observer class SettingsLayout extends Component { | |||
50 | type="button" | 68 | type="button" |
51 | className="settings__close mdi mdi-close" | 69 | className="settings__close mdi mdi-close" |
52 | onClick={closeSettings} | 70 | onClick={closeSettings} |
71 | aria-label={intl.formatMessage(messages.closeSettings)} | ||
53 | /> | 72 | /> |
54 | </div> | 73 | </div> |
55 | </ErrorBoundary> | 74 | </ErrorBoundary> |