reset comoponents

This commit is contained in:
Alex Holliday committed 2025-02-01 18:36:43 -08:00
1 parent 701e81cb78
commit 5a85711cac
3 files changed
+8 -12

No files matched your search

@@ -21,7 +21,6 @@ import "./index.css";
* @param {string} [props.value] - Optional value associated with the checkbox * @param {string} [props.value] - Optional value associated with the checkbox
* @param {Function} [props.onChange] - Callback function triggered when checkbox state changes * @param {Function} [props.onChange] - Callback function triggered when checkbox state changes
* @param {boolean} [props.isDisabled] - Determines if the checkbox is disabled * @param {boolean} [props.isDisabled] - Determines if the checkbox is disabled
* @param {boolean} [props.alignSelf] - Whether the checkbox label should be positioned on flex-start.
* *
* @returns {React.ReactElement} Rendered Checkbox component * @returns {React.ReactElement} Rendered Checkbox component
* *
@@ -55,12 +54,10 @@ const Checkbox = ({
value, value,
onChange, onChange,
isDisabled, isDisabled,
alignSelf
}) => { }) => {
/* TODO move sizes to theme */ /* TODO move sizes to theme */
const sizes = { small: "14px", medium: "16px", large: "18px" }; const sizes = { small: "14px", medium: "16px", large: "18px" };
const theme = useTheme(); const theme = useTheme();
const override = alignSelf? { alignSelf: "flex-start" } : {}
return ( return (
<FormControlLabel <FormControlLabel
className="checkbox-wrapper" className="checkbox-wrapper"
@@ -79,7 +76,6 @@ const Checkbox = ({
sx={{ sx={{
"&:hover": { backgroundColor: "transparent" }, "&:hover": { backgroundColor: "transparent" },
"& svg": { width: sizes[size], height: sizes[size] }, "& svg": { width: sizes[size], height: sizes[size] },
...override
}} }}
/> />
} }
@@ -57,7 +57,7 @@ const Search = ({
disabled, disabled,
startAdornment, startAdornment,
endAdornment, endAdornment,
onBlur onBlur,
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -70,15 +70,15 @@ const Search = ({
onInputChange={(_, newValue) => { onInputChange={(_, newValue) => {
handleInputChange(newValue); handleInputChange(newValue);
}} }}
onChange={(e, newValue) => { onChange={(_, newValue) => {
handleChange && handleChange(e, newValue); handleChange(newValue);
}} }}
fullWidth fullWidth
freeSolo freeSolo
disabled={disabled} disabled={disabled}
disableClearable disableClearable
options={options} options={options}
getOptionLabel={(option) => option[filteredBy]??""} getOptionLabel={(option) => option[filteredBy]}
renderInput={(params) => ( renderInput={(params) => (
<Stack> <Stack>
<Typography <Typography
@@ -213,7 +213,7 @@ Search.propTypes = {
options: PropTypes.array.isRequired, options: PropTypes.array.isRequired,
filteredBy: PropTypes.string.isRequired, filteredBy: PropTypes.string.isRequired,
secondaryLabel: PropTypes.string, secondaryLabel: PropTypes.string,
value: PropTypes.oneOfType([PropTypes.array, PropTypes.object]), value: PropTypes.array,
inputValue: PropTypes.string.isRequired, inputValue: PropTypes.string.isRequired,
handleInputChange: PropTypes.func.isRequired, handleInputChange: PropTypes.func.isRequired,
handleChange: PropTypes.func, handleChange: PropTypes.func,
@@ -223,7 +223,7 @@ Search.propTypes = {
disabled: PropTypes.bool, disabled: PropTypes.bool,
startAdornment: PropTypes.object, startAdornment: PropTypes.object,
endAdornment: PropTypes.object, endAdornment: PropTypes.object,
onBlur: PropTypes.func onBlur: PropTypes.func,
}; };
export default Search; export default Search;
@@ -6,7 +6,7 @@ import Visibility from "@mui/icons-material/Visibility";
import ReorderRoundedIcon from "@mui/icons-material/ReorderRounded"; import ReorderRoundedIcon from "@mui/icons-material/ReorderRounded";
import DeleteIcon from "../../../../assets/icons/trash-bin.svg?react"; import DeleteIcon from "../../../../assets/icons/trash-bin.svg?react";
export const HttpAdornment = ({ https, prefix }) => { export const HttpAdornment = ({ https }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<Stack <Stack
@@ -25,7 +25,7 @@ export const HttpAdornment = ({ https, prefix }) => {
color={theme.palette.primary.contrastTextSecondary} color={theme.palette.primary.contrastTextSecondary}
sx={{ lineHeight: 1, opacity: 0.8 }} sx={{ lineHeight: 1, opacity: 0.8 }}
> >
{prefix !== undefined ? prefix : https ? "https://" : "http://"} {https ? "https" : "http"}
</Typography> </Typography>
</Stack> </Stack>
); );