1 import React from "react";
2 import PropTypes from "prop-types";
3 import { Form, Icon, Button} from "react-bulma-components/full";
4 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
5 import { faTrashAlt, faComments } from '@fortawesome/free-solid-svg-icons'
14 const handleChange = (event) => {
15 const target = event.target;
16 const value = target.value;
17 onTermChange(index, value);
20 const handleAddTerm = (event) => {
24 const handleRemoveTerm = (event) => {
29 <div key={index} className="search-term">
30 <Form.Field kind="addons">
31 <Form.Control iconLeft iconRight>
32 <Form.Input type="text" value={value} onChange={handleChange} placeholder="Enter a term" />
34 <FontAwesomeIcon icon={faComments} />
38 <Button onClick={handleRemoveTerm} color="danger" outlined>
40 <FontAwesomeIcon icon={faTrashAlt} />
49 SearchTerm.propTypes = {
50 index: PropTypes.number.isRequired,
51 value: PropTypes.string.isRequired,
52 onTermChange: PropTypes.func.isRequired,
53 onAddTerm: PropTypes.func.isRequired,
54 onRemoveTerm: PropTypes.func.isRequired,
57 export default SearchTerm;