From dc2bf503d1a2863aa5d1108522a790e70330aa51 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 28 Jul 2020 15:59:57 -0400 Subject: [PATCH] Add AdvancedSearch propTypes and defaultProps --- .../src/components/Search/AdvancedSearch.jsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/awx/ui_next/src/components/Search/AdvancedSearch.jsx b/awx/ui_next/src/components/Search/AdvancedSearch.jsx index 13e573b61c..3aab1a5d03 100644 --- a/awx/ui_next/src/components/Search/AdvancedSearch.jsx +++ b/awx/ui_next/src/components/Search/AdvancedSearch.jsx @@ -1,5 +1,6 @@ import 'styled-components/macro'; import React, { useState } from 'react'; +import PropTypes from 'prop-types'; import { withI18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { @@ -134,7 +135,7 @@ function AdvancedSearch({ onCreateOption={setKeySelection} maxHeight="500px" > - {allKeys.map((optionKey) => ( + {allKeys.map(optionKey => ( {optionKey} @@ -265,6 +266,15 @@ function AdvancedSearch({ ); } -// TODO: prop types +AdvancedSearch.propTypes = { + onSearch: PropTypes.func.isRequired, + searchableKeys: PropTypes.arrayOf(PropTypes.string), + relatedSearchableKeys: PropTypes.arrayOf(PropTypes.string), +}; + +AdvancedSearch.defaultProps = { + searchableKeys: [], + relatedSearchableKeys: [], +}; export default withI18n()(AdvancedSearch);