1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-21 14:47:41 +01:00
smov/src2/components/InputBox.js

30 lines
920 B
JavaScript
Raw Normal View History

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>
)
}