CEC-4538 - Fleet/Vehicle/Deployment search saved (#363)

* CEC-4538 - Fleet/Vehicle/Deployment search saved

* save archived
This commit is contained in:
Paul Adamsen
2023-06-16 11:10:47 -04:00
committed by GitHub
parent a5c29a4721
commit 9ae3ef0e2e
4 changed files with 32 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import {
FormControl,
IconButton,
@@ -10,7 +10,7 @@ import SearchIcon from "@material-ui/icons/Search";
import clsx from "clsx";
const SearchField = (props) => {
const { classes, onSearch } = props;
const { classes, onSearch, savedSearchValue } = props;
const [searchTerm, setSearchTerm] = useState("");
const handleChange = (e) => {
setSearchTerm(e.target.value);
@@ -29,6 +29,12 @@ const SearchField = (props) => {
}
};
useEffect(() => {
if (savedSearchValue) {
setSearchTerm(savedSearchValue);
}
}, [savedSearchValue]);
return (
<FormControl className={clsx(classes.margin, classes.fullWidth)}>
<InputLabel htmlFor="search">Search</InputLabel>