import React from 'react' import enhanceWithClickOutside from 'react-click-outside' import shallowCompare from 'react-addons-shallow-compare' import { COLORS, EXPORT_SIZES } from '../lib/constants' import ExportButton from './ExportButton' import Button from './Button' import WindowPointer from './WindowPointer' class ExportMenu extends React.Component { state = { isVisible: false } shouldComponentUpdate(prevProps, prevState) { return ( prevState.isVisible !== this.state.isVisible || (prevState.isVisible && shallowCompare(this, prevProps, prevState)) ) } toggle = () => { this.setState({ isVisible: !this.state.isVisible }) } handleClickOutside = () => { this.setState({ isVisible: false }) } handleInputChange = e => { this.props.onChange('filename', e.target.value) } handleExportSizeChange = selectedSize => () => { this.props.onChange('exportSize', selectedSize) } handleExport = format => () => { this.props.export(format) } render() { const { exportSize, filename } = this.props const { isVisible } = this.state return (