svishnev | 8f13330 | 2018-08-06 23:08:39 +0300 | [diff] [blame] | 1 | /*! |
| 2 | * Copyright © 2016-2018 European Support Limited |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 13 | * or implied. See the License for the specific language governing |
| 14 | * permissions and limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import React from 'react'; |
| 18 | import PropTypes from 'prop-types'; |
| 19 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
| 20 | import Button from 'sdc-ui/lib/react/Button.js'; |
| 21 | import GridSection from 'nfvo-components/grid/GridSection.jsx'; |
| 22 | |
| 23 | const ModalButtons = ({ |
| 24 | isFormValid, |
| 25 | isReadOnlyMode, |
| 26 | onSubmit, |
| 27 | selectedLimit, |
| 28 | onCancel, |
| 29 | className |
| 30 | }) => ( |
| 31 | <GridSection className={`license-model-modal-buttons ${className}`}> |
| 32 | {!selectedLimit && ( |
| 33 | <Button |
| 34 | btnType="primary" |
| 35 | disabled={!isFormValid || isReadOnlyMode} |
| 36 | onClick={() => onSubmit()} |
| 37 | type="reset"> |
| 38 | {i18n('Save')} |
| 39 | </Button> |
| 40 | )} |
| 41 | <Button |
| 42 | btnType={selectedLimit ? 'primary' : 'secondary'} |
| 43 | onClick={() => onCancel()} |
| 44 | type="reset"> |
| 45 | {i18n('Cancel')} |
| 46 | </Button> |
| 47 | </GridSection> |
| 48 | ); |
| 49 | |
| 50 | ModalButtons.propTypes = { |
| 51 | isFormValid: PropTypes.func, |
| 52 | isReadOnlyMode: PropTypes.bool, |
| 53 | onSubmit: PropTypes.func, |
| 54 | selectedLimit: PropTypes.string, |
| 55 | onCancel: PropTypes.func, |
| 56 | className: PropTypes.string |
| 57 | }; |
| 58 | |
| 59 | export default ModalButtons; |