Resolve Settings page Select component errors

- Enhanced Select component to accept boolean values in PropTypes
- Updated component documentation to reflect new type support
- Added default value for showURL prop to prevent undefined value errors

- Fixed two related issues:
  1. Type mismatch error when passing boolean values
  2. Required prop error during initial rendering
This commit is contained in:
mohadeseh safari committed 2025-05-29 21:01:09 -04:00
1 parent 064fb1bfd9
commit aa91c9ff86
2 files changed
+5 -5

No files matched your search

@@ -12,9 +12,9 @@ import "./index.css";
* @param {string} props.placeholder - The label of the select element.
* @param {string} props.placeholder - The placeholder text when no option is selected.
* @param {boolean} props.isHidden - Whether the placeholder should be hidden.
* @param {string} props.value - The currently selected value.
* @param {(string | number | boolean)} props.value - The currently selected value.
* @param {object[]} props.items - The array of items to populate in the select dropdown.
* @param {(string | number)} props.items._id - The unique identifier of each item.
* @param {(string | number | boolean)} props.items._id - The unique identifier of each item.
* @param {string} props.items.name - The display name of each item.
* @param {function} props.onChange - The function to handle onChange event.
* @param {object} props.sx - The custom styles object for MUI Select component.
@@ -161,10 +161,10 @@ Select.propTypes = {
label: PropTypes.string,
placeholder: PropTypes.string,
isHidden: PropTypes.bool,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).isRequired,
items: PropTypes.arrayOf(
PropTypes.shape({
_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).isRequired,
name: PropTypes.string.isRequired,
})
).isRequired,
+1 -1
View File
@@ -9,7 +9,7 @@ import { useTheme } from "@emotion/react";
import { PropTypes } from "prop-types";
import { useTranslation } from "react-i18next";
const SettingsURL = ({ HEADING_SX, handleChange, showURL }) => {
const SettingsURL = ({ HEADING_SX, handleChange, showURL = false }) => {
const { t } = useTranslation();
const theme = useTheme();
return (