From e305d787228fd6b09c90a78b66aadd0b271bb84a Mon Sep 17 00:00:00 2001 From: M M Date: Sun, 5 May 2024 15:40:18 -0700 Subject: [PATCH] Added prop types to the dropdown feature. --- Client/src/App.jsx | 1 + Client/src/Dropdown.jsx | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Client/src/App.jsx b/Client/src/App.jsx index 0e69a8184..8e68abe5e 100644 --- a/Client/src/App.jsx +++ b/Client/src/App.jsx @@ -42,3 +42,4 @@ function App() { } export default App + diff --git a/Client/src/Dropdown.jsx b/Client/src/Dropdown.jsx index d7004d4a1..efdffe97f 100644 --- a/Client/src/Dropdown.jsx +++ b/Client/src/Dropdown.jsx @@ -1,4 +1,6 @@ import React from 'react'; +import PropTypes from 'prop-types'; + import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; @@ -7,7 +9,7 @@ const DropDown = ({ id, label, options, onChange, value }) => { option.name} // Assuming each team member object has a 'name' property + getOptionLabel={(option) => option.name} value={value} onChange={onChange} renderInput={(params) => } @@ -15,4 +17,13 @@ const DropDown = ({ id, label, options, onChange, value }) => { ); }; +// Define PropTypes for DropDown component +DropDown.propTypes = { + id: PropTypes.string.isRequired, + label: PropTypes.string.isRequired, + options: PropTypes.array.isRequired, + onChange: PropTypes.func.isRequired, + value: PropTypes.object.isRequired, +}; + export default DropDown;