2021-07-14 00:31:37 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { Arrow } from './Arrow';
|
|
|
|
import './InputBox.css'
|
|
|
|
|
|
|
|
// props = { onSubmit: (str) => {}, placeholder: string}
|
|
|
|
export function InputBox({ onSubmit, placeholder }) {
|
2021-07-14 17:15:25 +02:00
|
|
|
const [searchTerm, setSearchTerm] = React.useState("");
|
2021-07-14 00:31:37 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<form className="inputBar" onSubmit={(e) => {
|
|
|
|
e.preventDefault();
|
2021-07-15 00:09:42 +02:00
|
|
|
onSubmit(searchTerm)
|
2021-07-14 00:31:37 +02:00
|
|
|
return false;
|
|
|
|
}}>
|
|
|
|
<input
|
|
|
|
type='text'
|
|
|
|
className="inputTextBox"
|
|
|
|
id="inputTextBox"
|
|
|
|
placeholder={placeholder}
|
2021-07-14 17:15:25 +02:00
|
|
|
value={searchTerm}
|
|
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
|
|
required
|
2021-07-14 00:31:37 +02:00
|
|
|
/>
|
2021-07-15 00:09:42 +02:00
|
|
|
<button className="inputSearchButton">
|
|
|
|
<span className="text">Search<span className="arrow"><Arrow /></span></span>
|
|
|
|
</button>
|
2021-07-14 00:31:37 +02:00
|
|
|
</form>
|
|
|
|
)
|
|
|
|
}
|