Skip to content

Commit 9a197e3

Browse files
committed
Refactor RegionSelect to use predefined REGIONS constant
1 parent 46003cd commit 9a197e3

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

app/components/RegionSelect.tsx

+4-8
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ import {
66
SelectTrigger,
77
SelectValue,
88
} from "@/components/ui/select";
9+
import { REGIONS } from "@/constants/constants";
910

1011
type Props = {
1112
selectedRegion: string;
1213
setSelectedRegion: (region: string) => void;
13-
uniqueRegions: string[];
1414
};
1515

16-
const RegionSelect = ({
17-
selectedRegion = "all",
18-
setSelectedRegion,
19-
uniqueRegions,
20-
}: Props) => {
16+
const RegionSelect = ({ selectedRegion = "all", setSelectedRegion }: Props) => {
2117
return (
2218
<Select value={selectedRegion} onValueChange={setSelectedRegion}>
2319
<SelectTrigger className="md:w-52 h-14 px-5 shadow-sm dark:bg-gray-700 dark:border-gray-500/50">
@@ -26,7 +22,7 @@ const RegionSelect = ({
2622
<SelectContent>
2723
<SelectGroup>
2824
<SelectItem value="all">All Regions</SelectItem>
29-
{uniqueRegions.sort().map((region, idx) => (
25+
{REGIONS.sort().map((region, idx) => (
3026
<SelectItem key={idx} value={region}>
3127
{region}
3228
</SelectItem>
@@ -37,4 +33,4 @@ const RegionSelect = ({
3733
);
3834
};
3935

40-
export default RegionSelect;
36+
export default RegionSelect;

constants/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const REGIONS = ["Africa", "Americas", "Antarctic", "Asia", "Europe", "Oceania"];

0 commit comments

Comments
 (0)