- Replace Doc icon with Reorder icon

- Replace Text input with Search component
- Extend Search component to accept start and end adorment
This commit is contained in:
Shemy Gan committed 2024-12-27 20:59:03 -05:00
1 parent d844078ed7
commit 23d97f8e56
8 files changed
+122 -53

No files matched your search

+15 -7
View File
@@ -54,6 +54,8 @@ const Search = ({
isAdorned = true,
error,
disabled,
startAdornment,
endAdornment
}) => {
const theme = useTheme();
@@ -66,15 +68,15 @@ const Search = ({
onInputChange={(_, newValue) => {
handleInputChange(newValue);
}}
onChange={(_, newValue) => {
handleChange && handleChange(newValue);
onChange={(e, newValue) => {
handleChange && handleChange(e, newValue);
}}
fullWidth
freeSolo
disabled={disabled}
disableClearable
options={options}
getOptionLabel={(option) => option[filteredBy]}
getOptionLabel={(option) => option[filteredBy]??""}
renderInput={(params) => (
<Stack>
<Typography
@@ -89,9 +91,13 @@ const Search = ({
{...params}
error={Boolean(error)}
placeholder="Type to search"
InputProps={{
...params.InputProps,
...(isAdorned && { startAdornment: <SearchAdornment /> }),
slotProps={{
input: {
...params.InputProps,
...(isAdorned && { startAdornment: <SearchAdornment /> }),
...(startAdornment && { startAdornment: startAdornment }),
...(endAdornment && { endAdornment: endAdornment }),
},
}}
sx={{
"& fieldset": {
@@ -187,7 +193,7 @@ Search.propTypes = {
options: PropTypes.array.isRequired,
filteredBy: PropTypes.string.isRequired,
secondaryLabel: PropTypes.string,
value: PropTypes.array,
value: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
inputValue: PropTypes.string.isRequired,
handleInputChange: PropTypes.func.isRequired,
handleChange: PropTypes.func,
@@ -195,6 +201,8 @@ Search.propTypes = {
sx: PropTypes.object,
error: PropTypes.string,
disabled: PropTypes.bool,
startAdornment: PropTypes.object,
endAdornment: PropTypes.object
};
export default Search;
@@ -3,8 +3,8 @@ import { useTheme } from "@mui/material/styles";
import PropTypes from "prop-types";
import VisibilityOff from "@mui/icons-material/VisibilityOff";
import Visibility from "@mui/icons-material/Visibility";
import Docs from "../../../../assets/icons/docs.svg?react";
import DeleteIcon from "../../../../assets/icons/trash-bin.svg?react";
import ReorderRoundedIcon from '@mui/icons-material/ReorderRounded';
import DeleteIcon from "../../../../assets/icons/trash-bin.svg?react";
export const HttpAdornment = ({ https, prefix }) => {
const theme = useTheme();
@@ -70,7 +70,7 @@ PasswordEndAdornment.propTypes = {
export const ServerStartAdornment = () => {
return (
<InputAdornment position="start">
<Docs />
<ReorderRoundedIcon />
</InputAdornment>
);
};