1 import React from "react";
2 import PropTypes from "prop-types";
3 import SearchTerm from "./SearchTerm";
4 import {Button, Icon} from "react-bulma-components/full";
5 import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'
6 import {faPlus} from '@fortawesome/free-solid-svg-icons'
8 const SearchTermsInput = ({
14 const handleAddTerm = (event) => {
15 event.preventDefault();
19 const handleRemoveTerm = (id) => {
23 const handleTermChange = (id, value) => {
24 onTermChange(id, value);
27 const createSearchTerms = () => {
28 const searchTerms = [];
29 for (const entry of terms.entries()) {
31 const value = entry[1];
36 onTermChange={handleTermChange}
37 onAddTerm={handleAddTerm}
38 onRemoveTerm={handleRemoveTerm}/>
40 searchTerms.push(searchTerm);
46 <div className="search-terms-input">
47 <Button onClick={handleAddTerm}>
49 <FontAwesomeIcon icon={faPlus} />
62 SearchTermsInput.propTypes = {
63 terms: PropTypes.object.isRequired,
64 onTermChange: PropTypes.func.isRequired,
65 onAddTerm: PropTypes.func.isRequired,
66 onRemoveTerm: PropTypes.func.isRequired,
69 export default SearchTermsInput;