1
/* eslint-disable react/prop-types */
2

3 1
import React from 'react';
4 1
import { connect } from 'react-redux';
5

6 1
import * as actions from './actions';
7

8 1
import Button from '../../components/Button/Button';
9 1
import Icon from '../../components/Icon/Icon';
10

11
interface ExplorerToggleProps {
12
  onToggle(): void;
13
  children: React.ReactNode;
14
}
15

16
/**
17
 * A Button which toggles the explorer.
18
 */
19 1
const ExplorerToggle: React.FunctionComponent<ExplorerToggleProps> = ({ children, onToggle }) => (
20
  <Button
21
    dialogTrigger={true}
22
    onClick={onToggle}
23
  >
24
    <Icon name="folder-open-inverse" className="icon--menuitem" />
25
    {children}
26
    <Icon name="arrow-right" className="icon--submenu-trigger" />
27
  </Button>
28
);
29

30 1
const mapStateToProps = () => ({});
31

32 1
const mapDispatchToProps = (dispatch) => ({
33 1
  onToggle: (page) => dispatch(actions.toggleExplorer(page)),
34
});
35

36 1
const mergeProps = (_stateProps, dispatchProps, ownProps) => ({
37
  children: ownProps.children,
38
  onToggle: dispatchProps.onToggle.bind(null, ownProps.startPage),
39
});
40

41 1
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(ExplorerToggle);

Read our documentation on viewing source code .

Loading