Refactor out getCountryCodeOption()

This commit is contained in:
Gucheng Wang
2023-02-25 15:25:47 +08:00
parent 36c5a9d09b
commit 181e7c8c7d
4 changed files with 32 additions and 33 deletions

View File

@ -188,16 +188,15 @@ class OrganizationEditPage extends React.Component {
</Col>
<Col span={22} >
<Select virtual={false} mode={"multiple"} style={{width: "100%"}} value={this.state.organization.countryCodes ?? []}
options={Setting.getCountriesData().map(country => {
return Setting.getOption(
<>
{Setting.countryFlag(country)}
{`${country.name} +${country.phone}`}
</>,
country.code);
})} onChange={value => {
onChange={value => {
this.updateOrganizationField("countryCodes", value);
}} />
}}
filterOption={(input, option) => (option?.text ?? "").toLowerCase().includes(input.toLowerCase())}
>
{
Setting.getCountryCodeData().map((country) => Setting.getCountryCodeOption(country))
}
</Select>
</Col>
</Row>
<Row style={{marginTop: "20px"}} >