Skip to content

Commit

Permalink
Added propTypes and defaultProps for the new cloud provider form
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Feb 25, 2020
1 parent ceaf171 commit c486843
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import { componentTypes, validatorTypes } from '@data-driven-forms/react-form-renderer';

import { API } from '../../../http_api';
Expand Down Expand Up @@ -55,7 +56,7 @@ const initialSchema = includeType => ([
},
]);

const CloudProviderForm = ({ providerId, kind, redirect, ...props }) => {
const CloudProviderForm = ({ providerId, kind, redirect }) => {
const [{ type, schema, values }, setState] = useState({ schema: { fields: [] } });

const loadProviderSchema = (type, newValues = {}) => {
Expand Down Expand Up @@ -153,5 +154,17 @@ const CloudProviderForm = ({ providerId, kind, redirect, ...props }) => {
);
};

CloudProviderForm.propTypes = {
providerId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
kind: PropTypes.string,
redirect: PropTypes.string,
};

CloudProviderForm.defaultProps = {
providerId: undefined,
kind: undefined,
redirect: undefined,
};

export const EditingContext = React.createContext({});
export default CloudProviderForm;

0 comments on commit c486843

Please sign in to comment.