You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SidePanel.web.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { closePanel } from '../actions';
  5. /**
  6. * React Component for holding features in a side panel that slides in and out.
  7. *
  8. * @extends Component
  9. */
  10. class SidePanel extends Component {
  11. /**
  12. * {@code SidePanel} component's property types.
  13. *
  14. * @static
  15. */
  16. static propTypes = {
  17. dispatch: PropTypes.func
  18. };
  19. /**
  20. * Initializes a new {@code SidePanel} instance.
  21. *
  22. * @param {Object} props - The read-only properties with which the new
  23. * instance is to be initialized.
  24. */
  25. constructor(props) {
  26. super(props);
  27. this._onCloseClick = this._onCloseClick.bind(this);
  28. }
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. return (
  37. <div id = 'sideToolbarContainer'>
  38. <div
  39. className = 'side-toolbar-close'
  40. onClick = { this._onCloseClick }>
  41. X
  42. </div>
  43. </div>
  44. );
  45. }
  46. /**
  47. * Callback invoked to hide {@code SidePanel}.
  48. *
  49. * @returns {void}
  50. */
  51. _onCloseClick() {
  52. this.props.dispatch(closePanel());
  53. }
  54. }
  55. export default connect()(SidePanel);