Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions website3.0/pages/ResourcesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ const CustomDropdown = ({
const [currentValue, setCurrentValue] = useState(value);

useEffect(() => {
setCurrentValue(value.charAt(0).toUpperCase() + value.slice(1));
setCurrentValue(value[0].toUpperCase() + value.slice(1));
}, [value]);

const handleOptionSelect = (option) => {
if (typeof option === "object") {
setCurrentValue(
option.value.charAt(0).toUpperCase() + option.value.slice(1)
option.value[0].toUpperCase() + option.value.slice(1)
);
onSelect(option.value);
onChange({ target: { value: option.value } });
} else if (typeof option === "string") {
setCurrentValue(option.charAt(0).toUpperCase() + option.slice(1));
setCurrentValue(option[0].toUpperCase() + option.slice(1));
onSelect(option);
onChange({ target: { value: option } });
}
Expand Down Expand Up @@ -74,7 +74,7 @@ const CustomDropdown = ({

{dropdownOpen && (
<div className="absolute z-10 mt-2 w-full bg-white border border-gray-300 rounded-lg shadow-md">
{options.map((option) => (
{(options ?? []).map((option) => (
<div
key={option.value}
onClick={() => handleOptionSelect(option.value)}
Expand Down
Loading