import React, { Component } from 'react' import PropTypes from 'prop-types' import ReactCSSTransitionGroup from 'react-addons-css-transition-group' import WalletView from '../wallet-view' import { WALLET_VIEW_SIDEBAR } from './sidebar.constants' import CustomizeGas from '../gas-customization/gas-modal-page-container/' export default class Sidebar extends Component { static propTypes = { sidebarOpen: PropTypes.bool, hideSidebar: PropTypes.func, sidebarShouldClose: PropTypes.bool, transitionName: PropTypes.string, type: PropTypes.string, sidebarProps: PropTypes.object, }; renderOverlay () { return
this.props.hideSidebar()} /> } renderSidebarContent () { const { type, sidebarProps = {} } = this.props const { transaction = {} } = sidebarProps switch (type) { case WALLET_VIEW_SIDEBAR: return case 'customize-gas': return
default: return null } } componentDidUpdate (prevProps) { if (!prevProps.sidebarShouldClose && this.props.sidebarShouldClose) { this.props.hideSidebar() } } render () { const { transitionName, sidebarOpen, sidebarShouldClose } = this.props return (
{ sidebarOpen && !sidebarShouldClose ? this.renderSidebarContent() : null } { sidebarOpen && !sidebarShouldClose ? this.renderOverlay() : null }
) } }