]> cat aescling's git repositories - mastodon.git/blob - app/javascript/glitch/components/compose/advanced_options/container.js
Merge pull request #223 from glitch-soc/glitchsoc/feature/configurable-status-size
[mastodon.git] / app / javascript / glitch / components / compose / advanced_options / container.js
1 /*
2
3 `<ComposeAdvancedOptionsContainer>`
4 ===================================
5
6 This container connects `<ComposeAdvancedOptions>` to the Redux store.
7
8 */
9
10 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
11
12 /*
13
14 Imports:
15 --------
16
17 */
18
19 // Package imports //
20 import { connect } from 'react-redux';
21
22 // Mastodon imports //
23 import { toggleComposeAdvancedOption } from '../../../../mastodon/actions/compose';
24
25 // Our imports //
26 import ComposeAdvancedOptions from '.';
27
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29
30 /*
31
32 State mapping:
33 --------------
34
35 The `mapStateToProps()` function maps various state properties to the
36 props of our component. The only property we care about is
37 `compose.advanced_options`.
38
39 */
40
41 const mapStateToProps = state => ({
42 values: state.getIn(['compose', 'advanced_options']),
43 });
44
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
46
47 /*
48
49 Dispatch mapping:
50 -----------------
51
52 The `mapDispatchToProps()` function maps dispatches to our store to the
53 various props of our component. We just need to provide a dispatch for
54 when an advanced option toggle changes.
55
56 */
57
58 const mapDispatchToProps = dispatch => ({
59
60 onChange (option) {
61 dispatch(toggleComposeAdvancedOption(option));
62 },
63
64 });
65
66 export default connect(mapStateToProps, mapDispatchToProps)(ComposeAdvancedOptions);
This page took 0.117594 seconds and 4 git commands to generate.