This repository has been archived on 2024-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
2020-12-10 23:17:14 -05:00

43 lines
1019 B
JavaScript

import React from "react";
// Inline search bar with direct UUID linking,
// Changes URL and populates the form at /migrations/ with the information from the request
class InLineSearch extends React.Component {
constructor(props) {
super(props);
this.state = { data: "" };
this.onChange = this.onChange.bind(this);
}
onChange(e) {
this.setState({ data: e.target.value });
}
onKeyPressed = (e) => {
// This is so we can access the state within the function
if (e.keyCode === 13) {
window.location.href =
"https://devui.benjamyn.love/migrations/" + this.state.data;
}
};
render() {
return (
<span>
<input
className="right"
name="uuidIn"
value={this.state.data}
onChange={this.onChange}
onKeyDown={this.onKeyPressed}
placeholder="Enter Migration UUID"
id="search"
type="search"
required
/>
</span>
);
}
}
export default InLineSearch;