import _ from 'lodash'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { inputTypes } from 'Helpers/Props'; import Button from 'Components/Link/Button'; import Form from 'Components/Form/Form'; import FormGroup from 'Components/Form/FormGroup'; import FormLabel from 'Components/Form/FormLabel'; import FormInputGroup from 'Components/Form/FormInputGroup'; import ModalContent from 'Components/Modal/ModalContent'; import ModalHeader from 'Components/Modal/ModalHeader'; import ModalBody from 'Components/Modal/ModalBody'; import ModalFooter from 'Components/Modal/ModalFooter'; const posterSizeOptions = [ { key: 'small', value: 'Small' }, { key: 'medium', value: 'Medium' }, { key: 'large', value: 'Large' } ]; class AddListMoviePosterOptionsModalContent extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { size: props.size, showTitle: props.showTitle }; } componentDidUpdate(prevProps) { const { size, showTitle } = this.props; const state = {}; if (size !== prevProps.size) { state.size = size; } if (showTitle !== prevProps.showTitle) { state.showTitle = showTitle; } if (!_.isEmpty(state)) { this.setState(state); } } // // Listeners onChangePosterOption = ({ name, value }) => { this.setState({ [name]: value }, () => { this.props.onChangePosterOption({ [name]: value }); }); } // // Render render() { const { onModalClose } = this.props; const { size, showTitle } = this.state; return ( Poster Options
Poster Size Show Title
); } } AddListMoviePosterOptionsModalContent.propTypes = { size: PropTypes.string.isRequired, showTitle: PropTypes.bool.isRequired, onChangePosterOption: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default AddListMoviePosterOptionsModalContent;