aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/current_standard_sliding_panel.ts
blob: 82ac7fa1ba00e65639f35afe9c16bf9817807e1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import * as React from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';

import { StandardSlidingPanel } from '../components/standard_sliding_panel';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
import { StandardSlidingPanelSettings } from '../types';

export interface CurrentStandardSlidingPanelProps {}

interface ConnectedState extends StandardSlidingPanelSettings {}

interface ConnectedDispatch {
    onClose: () => void;
}

const mapStateToProps = (state: State, _ownProps: CurrentStandardSlidingPanelProps): ConnectedState =>
    state.standardSlidingPanelSettings;

const mapDispatchToProps = (
    dispatch: Dispatch<Action>,
    ownProps: CurrentStandardSlidingPanelProps,
): ConnectedDispatch => ({
    onClose: () => dispatch(actions.closeStandardSlidingPanel()),
});

export const CurrentStandardSlidingPanel: React.ComponentClass<CurrentStandardSlidingPanelProps> = connect(
    mapStateToProps,
    mapDispatchToProps,
)(StandardSlidingPanel);