diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-07-30 11:41:54 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-07-30 11:41:54 +0200 |
commit | d7ed456a7b6f73e046ba3a2ef38eb21f82f06ca4 (patch) | |
tree | f24f4f39ae38bdfdd581f451fc3e2e79f5670df5 /src/features/todos/containers | |
parent | Fix position of todos app (diff) | |
download | ferdium-app-d7ed456a7b6f73e046ba3a2ef38eb21f82f06ca4.tar.gz ferdium-app-d7ed456a7b6f73e046ba3a2ef38eb21f82f06ca4.tar.zst ferdium-app-d7ed456a7b6f73e046ba3a2ef38eb21f82f06ca4.zip |
Make todo layer resizable
Diffstat (limited to 'src/features/todos/containers')
-rw-r--r-- | src/features/todos/containers/TodosScreen.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/features/todos/containers/TodosScreen.js b/src/features/todos/containers/TodosScreen.js new file mode 100644 index 000000000..0759c22db --- /dev/null +++ b/src/features/todos/containers/TodosScreen.js | |||
@@ -0,0 +1,45 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | import PropTypes from 'prop-types'; | ||
4 | |||
5 | import TodosWebview from '../components/TodosWebview'; | ||
6 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | ||
7 | import UserStore from '../../../stores/UserStore'; | ||
8 | import TodoStore from '../store'; | ||
9 | import { TODOS_MIN_WIDTH } from '..'; | ||
10 | |||
11 | @inject('stores', 'actions') @observer | ||
12 | class TodosScreen extends Component { | ||
13 | static propTypes = { | ||
14 | stores: PropTypes.shape({ | ||
15 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
16 | todos: PropTypes.instanceOf(TodoStore).isRequired, | ||
17 | }).isRequired, | ||
18 | actions: PropTypes.shape({ | ||
19 | todos: PropTypes.shape({ | ||
20 | resize: PropTypes.func.isRequired, | ||
21 | }), | ||
22 | }).isRequired, | ||
23 | }; | ||
24 | |||
25 | render() { | ||
26 | const { stores, actions } = this.props; | ||
27 | |||
28 | if (!stores.todos || !stores.todos.isFeatureActive) { | ||
29 | return null; | ||
30 | } | ||
31 | |||
32 | return ( | ||
33 | <ErrorBoundary> | ||
34 | <TodosWebview | ||
35 | authToken={stores.user.authToken} | ||
36 | width={stores.todos.width} | ||
37 | minWidth={TODOS_MIN_WIDTH} | ||
38 | resize={width => actions.todos.resize({ width })} | ||
39 | /> | ||
40 | </ErrorBoundary> | ||
41 | ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | export default TodosScreen; | ||