This adds a `TextList` with additional information for a chosen activation key in Registration step of the Wizard. Component `AdditionalKeyInformation` is wrapped within a new component called `RegistrationKeyInformation` for the purpose of displaying the information on the Registration step. As the component needed to use `FormSpy` element to work properly in this context within the Data Driven Forms. Without it the validation of the form didn't work as expected, because of a persisting reference to the element it was evaluated against. Popover for an Activation key was also updated according to SPUR mocks.
29 lines
741 B
JavaScript
29 lines
741 B
JavaScript
import React from 'react';
|
|
|
|
import { FormSpy } from '@data-driven-forms/react-form-renderer';
|
|
import { FormGroup } from '@patternfly/react-core';
|
|
import { isEmpty } from 'lodash';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import ActivationKeyInformation from './ActivationKeyInformation';
|
|
|
|
const RegistrationKeyInformation = ({ label, valueReference }) => {
|
|
return (
|
|
<FormSpy>
|
|
{({ values }) =>
|
|
isEmpty(values[valueReference]) ? null : (
|
|
<FormGroup label={label}>
|
|
<ActivationKeyInformation />
|
|
</FormGroup>
|
|
)
|
|
}
|
|
</FormSpy>
|
|
);
|
|
};
|
|
|
|
RegistrationKeyInformation.propTypes = {
|
|
label: PropTypes.node,
|
|
valueReference: PropTypes.node,
|
|
};
|
|
|
|
export default RegistrationKeyInformation;
|