Add AdvancedSearch propTypes and defaultProps

This commit is contained in:
John Mitchell
2020-07-28 15:59:57 -04:00
parent 2229d43e8b
commit dc2bf503d1

View File

@@ -1,5 +1,6 @@
import 'styled-components/macro'; import 'styled-components/macro';
import React, { useState } from 'react'; import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { import {
@@ -134,7 +135,7 @@ function AdvancedSearch({
onCreateOption={setKeySelection} onCreateOption={setKeySelection}
maxHeight="500px" maxHeight="500px"
> >
{allKeys.map((optionKey) => ( {allKeys.map(optionKey => (
<SelectOption key={optionKey} value={optionKey}> <SelectOption key={optionKey} value={optionKey}>
{optionKey} {optionKey}
</SelectOption> </SelectOption>
@@ -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); export default withI18n()(AdvancedSearch);