import React from 'react'; import PropTypes from 'prop-types'; import { translate } from 'react-i18next'; import { Button, Modal, ModalHeader, ModalBody, Label, Input, ModalFooter } from 'reactstrap'; export class AddCategoryPopup extends React.Component { state = { folderName: '' }; static propTypes = { parentId: PropTypes.number.isRequired, hideAddCategoryPopup: PropTypes.func.isRequired, addCategory: PropTypes.func.isRequired, t: PropTypes.func.isRequired }; onChangeName = (e) => { const { value } = e.target; // need validation this.setState({ folderName: value }); }; hidePopup = () => { this.props.hideAddCategoryPopup(); }; onSubmit = () => { const { folderName } = this.state; this.props.addCategory(folderName, this.props.parentId); this.props.hideAddCategoryPopup(); }; render() { const { t } = this.props; const { folderName } = this.state; return ( {t('sidebarPopup.addFolderBtn')} ); } } export default translate(['common'], { wait: true })(AddCategoryPopup);