@@ -6,6 +6,7 @@ import PropTypes from "prop-types";
66import Form from "react-bootstrap/Form" ;
77import LoadingComponent from "../util/loading-component/loading-component" ;
88import FormInputArea from "../util/forms/form-input-area" ;
9+ import FormSelect from "../util/forms/select" ;
910import ContentBody from "../util/content-body/content-body" ;
1011import ContentFooter from "../util/content-footer/content-footer" ;
1112import FormInput from "../util/forms/form-input" ;
@@ -14,12 +15,17 @@ import FormInput from "../util/forms/form-input";
1415 * The feed-source form component.
1516 *
1617 * @param {object } props - The props.
17- * @param {object } props.feed-source The feed-source object to modify in the form.
18+ * @param {object } props.feedSource The feed-source object to modify in the form.
1819 * @param {Function } props.handleInput Handles form input.
1920 * @param {Function } props.handleSubmit Handles form submit.
2021 * @param {string } props.headerText Headline text.
21- * @param {boolean } props.isLoading Indicator of whether the form is loading
22- * @param {string } props.loadingMessage The loading message for the spinner
22+ * @param {boolean } [props.isLoading=false] Indicator of whether the form is
23+ * loading. Default is `false`
24+ * @param {string } [props.loadingMessage=""] The loading message for the
25+ * spinner. Default is `""`
26+ * @param {object } props.feedSource The feed source object
27+ * @param {object } props.feedSourceTypeOptions The options for feed source types
28+ * @param {element } props.dynamicFormElement The dynamic form element
2329 * @returns {object } The feed-source form.
2430 */
2531function FeedSourceForm ( {
@@ -29,6 +35,8 @@ function FeedSourceForm({
2935 isLoading = false ,
3036 loadingMessage = "" ,
3137 feedSource = null ,
38+ feedSourceTypeOptions = null ,
39+ dynamicFormElement = null ,
3240} ) {
3341 const { t } = useTranslation ( "common" , { keyPrefix : "feed-source-form" } ) ;
3442 const navigate = useNavigate ( ) ;
@@ -56,12 +64,12 @@ function FeedSourceForm({
5664 value = { feedSource . description }
5765 onChange = { handleInput }
5866 />
59- < FormInputArea
60- name = "feedType"
61- type = "text"
67+ < FormSelect
6268 label = { t ( "feed-source-feed-type-label" ) }
69+ name = "feedType"
6370 value = { feedSource . feedType }
6471 onChange = { handleInput }
72+ options = { feedSourceTypeOptions }
6573 />
6674 < FormInputArea
6775 name = "supportedFeedOutputType"
@@ -70,6 +78,7 @@ function FeedSourceForm({
7078 value = { feedSource . supportedFeedOutputType }
7179 onChange = { handleInput }
7280 />
81+ { dynamicFormElement }
7382 </ ContentBody >
7483 < ContentFooter >
7584 < Button
@@ -99,16 +108,25 @@ function FeedSourceForm({
99108
100109FeedSourceForm . propTypes = {
101110 feedSource : PropTypes . shape ( {
102- cssStyles : PropTypes . string ,
103- logo : PropTypes . shape ( { } ) ,
104- description : PropTypes . string ,
105111 title : PropTypes . string ,
112+ description : PropTypes . string ,
113+ feedType : PropTypes . string ,
114+ supportedFeedOutputType : PropTypes . string ,
106115 } ) ,
107116 handleInput : PropTypes . func . isRequired ,
108117 handleSubmit : PropTypes . func . isRequired ,
109118 headerText : PropTypes . string . isRequired ,
110119 isLoading : PropTypes . bool ,
111120 loadingMessage : PropTypes . string ,
121+ dynamicFormElement : PropTypes . node ,
122+ feedSourceTypeOptions : PropTypes . arrayOf (
123+ PropTypes . shape ( {
124+ value : PropTypes . string ,
125+ title : PropTypes . string ,
126+ key : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
127+ template : PropTypes . node ,
128+ } )
129+ ) ,
112130} ;
113131
114132export default FeedSourceForm ;
0 commit comments