Skip to content

Commit

Permalink
fix: country iso code mapping (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos authored Jan 10, 2025
1 parent 0b0b069 commit 162111c
Show file tree
Hide file tree
Showing 2 changed files with 655 additions and 143 deletions.
10 changes: 8 additions & 2 deletions src/components/form/CountryField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { type ChipTypeMap } from "@mui/material"
import { type ElementType } from "react"
import { COUNTRY_ISO_CODES } from "../../utils/general"
import {
COUNTRY_ISO_CODES,
COUNTRY_ISO_CODE_MAPPING,
type CountryIsoCodes,
} from "../../utils/general"
import AutocompleteField, {
type AutocompleteFieldProps,
} from "./AutocompleteField"
Expand Down Expand Up @@ -58,7 +62,9 @@ const CountryField = <
return (
<AutocompleteField
options={COUNTRY_ISO_CODES}
getOptionLabel={isoCode => isoCode} // TODO: return country name
getOptionLabel={isoCode =>
COUNTRY_ISO_CODE_MAPPING[isoCode as CountryIsoCodes]
}
textFieldProps={{ name, label, placeholder, ...otherTextFieldProps }}
{...otherAutocompleteFieldProps}
/>
Expand Down
Loading

0 comments on commit 162111c

Please sign in to comment.