debian-image-builder-frontend/src/Components/CreateImageWizard/steps/stepTemplate.js
Sanne Raymaekers a0883793ba CreateImageWizard: Step template with id
The template is the default template from data driven forms, with the id
added.

Fixes #642
2022-03-25 12:43:31 +01:00

27 lines
878 B
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { Title } from '@patternfly/react-core';
const StepTemplate = ({ id, formFields, formRef, title, showTitle, showTitles }) => (
<div id={ id } ref={ formRef } className="pf-c-form">
{((showTitles && showTitle !== false) || showTitle) &&
(<Title headingLevel="h1" size="xl">
{title}
</Title>)}
{formFields}
</div>
);
StepTemplate.propTypes = {
id: PropTypes.string,
title: PropTypes.node,
formFields: PropTypes.array.isRequired,
formOptions: PropTypes.shape({
renderForm: PropTypes.func.isRequired,
}).isRequired,
showTitles: PropTypes.bool,
showTitle: PropTypes.bool,
formRef: PropTypes.oneOfType([ PropTypes.func, PropTypes.shape({ current: PropTypes.instanceOf(Element) }) ]),
};
export default StepTemplate;