import React, { useState } from 'react'; import PropTypes from 'prop-types'; import Modal from '../../modal'; import TextField from '../../../ui/text-field'; import Button from '../../../ui/button'; import Typography from '../../../ui/typography'; import { TYPOGRAPHY, FONT_WEIGHT, ALIGN_ITEMS, BLOCK_SIZES, DISPLAY, } from '../../../../helpers/constants/design-system'; import Box from '../../../ui/box'; import withModalProps from '../../../../helpers/higher-order-components/with-modal-props'; import { useI18nContext } from '../../../../hooks/useI18nContext'; const CustomizeNonce = ({ hideModal, customNonceValue, nextNonce, updateCustomNonce, getNextNonce, }) => { const [customNonce, setCustomNonce] = useState(''); const t = useI18nContext(); return ( { if (customNonce === '') { updateCustomNonce(customNonceValue); } else { updateCustomNonce(customNonce); } getNextNonce(); hideModal(); }} submitText={t('save')} submitType="primary" onCancel={() => hideModal()} cancelText={t('cancel')} cancelType="secondary" rounded contentClass="customize-nonce-modal-content" containerClass="customize-nonce-modal-container" >
{t('editNonceField')}
{t('editNonceMessage')} {t('editNonceField')}
{ setCustomNonce(e.target.value); }} fullWidth margin="dense" value={customNonce} id="custom-nonce-id" />
); }; CustomizeNonce.propTypes = { hideModal: PropTypes.func.isRequired, customNonceValue: PropTypes.string, nextNonce: PropTypes.number, updateCustomNonce: PropTypes.func, getNextNonce: PropTypes.func, }; export default withModalProps(CustomizeNonce);